chiccodoro chiccodoro - 29 days ago 18
C# Question

Jasmine for C# and/or Java

Jasmine is a nice unit testing framework for JavaScript. It not only tests your code, it provides a nice way to document it by:


  • Using a fluent BDD-ish way to define tests that in itself almost reads like a documentation

  • The test report reads like a documentation too



I'm wondering if anything comparable exists for C# and/or Java.

Answer

I just came across NJasmine on GitHub. I've never used it but thought this might help others like myself that want the awesome of Jasamine in C# unit tests.

From the GitHub:

NJasmine is a RSpec-ish test language inspired by the javascript test library Jasmine (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 can't vouch for this as I haven't used it, but I hope putting this info here it will help others make informed decisions.

HTH