Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert C# unit test names to English (testdox style)

I have a whole bunch of unit tests written in MbUnit and I would like to generate plain English sentences from test names. The concept is introduced here:

http://dannorth.net/introducing-bdd

This is from the article:

public class CustomerLookupTest extends TestCase {
    testFindsCustomerById() {
        ...
    }
    testFailsForDuplicateCustomers() {
        ...
    }
    ...
}

renders something like this:

CustomerLookup
- finds customer by id
- fails for duplicate customers
- ...

Unfortunately the tool quoted in the above article (testdox) is Java based. Is there one for .NET?

Sounds like this would be something pretty simple to write, but I simply don't have the bandwidth and want to use something already written.

EDIT: Just to clarify the question. I am looking at something that can whiz through existing tests and convert CamelCase function names into sentences. Seems like a perfect job for some sort of Gallio plugin.

So far I somehow found SpecUnit and Jay has suggested BDDDoc. Both of those are behaviour verification frameworks that will require a significant rewrite of the exisitng tests. Our team has made the decision to go with SpecFlow as a main BDD framework and what I was trying to achieve is to generate a report of the existing tests to see how well it fits the BDD approach.

like image 645
Igor Zevaka Avatar asked Jan 24 '26 04:01

Igor Zevaka


2 Answers

There is a TestDox for .NET It seems fairly recent (2010).

like image 81
Martin Moene Avatar answered Jan 25 '26 18:01

Martin Moene


For a presentation last year I have created a small BDD unit testing helper that displays the method names being executed in normal English. The string magic part of it is quite thin so you can surely extract it from it.

Here is my post with the link to the download: http://gasparnagy.blogspot.com/2009/10/devcamp09-behavior-driven-development.html

like image 41
Gaspar Nagy Avatar answered Jan 25 '26 19:01

Gaspar Nagy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!