Jasmine for C # and / or Java

Jasmine is a great modular platform for JavaScript. It not only checks your code, but also provides a convenient way to document it:

  • Using the free BDD-ish method to define tests that themselves almost read like documentation
  • The test report is also read as documentation.

I am wondering if something comparable exists for C # and / or Java.

+7
source share
6 answers

I just stumbled upon NJasmine on GitHub. I never used it, but thought it could help others, like me, who want awesome Jasamine in C # unit tests.

From GitHub:

NJasmine is the RSpec-ish testing language created by the Javascript Jasmine library ( http://pivotal.github.com/jasmine/ ) for C # /. Net programming.

given("some preconditions", () => { var range = 10; when("the system under test is ran", () => { var sut = new SystemUnderTest(); bool score = arrange(() => sut.Fire(range)); then("win!", () => { expect(() => score); }); }); }); 

Available on Nuget: http://nuget.org/List/Packages/NJasmine

Again, I cannot vouch for this because I have not used it, but I hope that this information will be posted here, this will help others make informed decisions.

NTN

+4
source

Oleaster is a Java testing platform with clean, simple syntax that makes extensive use of Java 8 arrow features. It is run using the JUnit runner.

Sample code from hompage:

 @RunWith(OleasterRunner.class) public class OleasterIntroductionTest {{ describe("A suite", () -> { it("contains a spec with an expectation", () -> { expect(40 + 2).toEqual(42); }); }); }} 
+4
source

JUnit 5 will be BDD-like, with @DisplayName, @Nested, etc. You can look in the documentation .

The GA release does not yet exist, but it should be available soon (announced at the end of 2016).

+3
source

A very popular basis for testing Java (and Groovy) is Spock , whose tests are also read as written specifications.

+2
source

See Cucumber-JVM for BDD implementation. It is based on Java, but also works with JVM-based languages ​​(Scala, Groovy).

When using a continuous integration system such as Jenkins, there is a plug-in for reports called Cucumber Reports .

+2
source

equivalent for java will be jbehave

+1
source

All Articles