Tag Archives: testing

Rapid Generation of test objects

I came across a very easy to use and useful generation tool for objects today, NBuilder.

Through a fluent, extensible interface, NBuilder allows you to rapidly create test data, automatically assigning values to properties and public fields that are of type of the built in .NET data types (e.g. ints and strings). NBuilder allows you to override for properties you are interested in using lambda expressions.

If you understand Lambda then you’re going to be able to build test data for your objects.

All you need to do is reference FizzWare.NBuilder.dll in to your test project and you are off.

FizzWare.NBuilder-2.1.9-beta.zip (32.47 kb)

Running NUnit from Visual Studio

If you are like me, I like to keep my Visual Studio environment as clean as possible, so if I can get away from adding any addins in to Visual Studio I will always go for that option.

So when it comes to testing I prefer to run with NUnit and run it as n external program.  

To do this just right click on the unit test project -> choosing the properties option -> setecting the Debug tab -> choose “start external program” and enter the NUnit assembly path, in my case this is “C:\Program Files\NUnit 2.5\bin\net-2.0\nunit.exe”, next is to select the command line arguments and point this to your unit test dll,

e.g.  “C:\Program Files\NUnit 2.5\samples\csharp\money\bin\Debug\cs-money.dll” /run

The “run” parameter will automatically run the loaded project

Alternatively you can use a Visual Studio add-in such as TestDriven.Net, this also provides NCoverExplorer to provide you with code coverage.