Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating documentation from unit tests

We have machine specifications and we have specflow. Specflow translates a textual description into unit tests. But is there any tool that will take NUnit fixtures and create a textual description something like the input of Specflow? Basically the opposite of what specflow is doing.

I'm prepared to adjust how I format my unit-test regarding fixture name and test method name. But I'd rather not use any super fancy syntaxes like machine specifications, but rather just plain NUnit tests fixtures. The reason is that the tests are important and need to be refactorable, etc. Text formats are not so refactor friendly as unit-tests.

For example:

[TestFixture] 
class Given_Four
{
    private Calculator c;

    [SetUp]
    public void Setup()
    {
        c = new Calculator(4);
    }

    [Test]
    public void When_adding_two_then_sum_should_be_six()
    {
        c.Add(2)
        Assert.That(c.Display, Is.EqualTo(6));
    }
}

Again, this just an example. Basically any format of the will work, just as long as the tool creates a textual description of this test fixture. I've been googling around, but found nothing. Do you know of any such tool?

like image 862
vidstige Avatar asked Jul 10 '12 14:07

vidstige


People also ask

Should unit tests be documented?

Unit tests should aim to be self descriptive, but there will always be cases where this goal cannot be achieved and thus description of what has been written is due. In other words, try to make your unit tests so they don't need documentation, but if they need it, write it!


1 Answers

You could try the report runner from the Gallio Test automation framework?

Though the site seems to be down at the moment

http://gallio.org/Downloads.aspx

http://code.google.com/p/mb-unit/

like image 80
Chris McKelt Avatar answered Oct 20 '22 15:10

Chris McKelt