Friday, December 28, 2007

NUnit 2.4 is here with support to VS2008 and RowTest

This is really cool. So far NUnit was legging one cool feature of MBUnit - RowTest

Not any more. NUnit 2.4 is here to kick that legging :)

IDE support is included as extension in Test Driven .NET 2.11. you can download from here. Row extension binary is here

Click on one for 2.4.5 and the zip file will have two dlls (NUnitExtension.RowTest.AddIn.dll and NUnitExtension.RowTest.dll )

After you install Test Driven .NET 2.11, navigate to '%ProgramFiles%\TestDriven.NET 2.0\NUnit\2.4' and create subdirectory called addins. Then copy NUnitExtension.RowTest.AddIn.dll inside addins. Its is required that you don't keep any other non dll file in this folder. Click here to know why?

Finally use NUnitExtension.RowTest.dll as your BinRef in the UnitTest or IntegrationTest Project.

Now writing test is very simple. Here is the snippet

using NUnitExtension.RowTest;

namespace Mahendra
{
[TestFixture]
public class RowTestDemoTester
{
[RowTest]
[Row(100,20,120)]
[Row(10,11,21)]
[Row(20,30,51)]
public void Simple_Addition_Test(int a, int b, int sum)
{
Assert.AreEqual(sum, a+b);
}
}
}

What is even cool is, once you install TestDriven.net 2.11, right click on your test project and you will see under Test With submenu -> all your previous installation of NUnit as well. i.e. in my case it is NUnit 2.2 and NUnit 2.4

If you choose to test using NUnit 2.2 (any one prior to NUnit2.4) all the RowTest will be simply ignored without giving any compilation error or failing test.

Develop smartly :)

No comments: