tags:

views:

94

answers:

1

Hi Guys.

I'm just getting into TDD, and from looking around, the general concensis seems to be to have a one to one mapping from a code project to a test project. My question is, if you follow this route, and have multiple test assemblies, what is the best way to run these as part of an NAnt script? If it makes a difference, I am using NUnit as my testing framework.

A: 

You can create a "test project" via the NUnit GUI, and save it to a file. In the GUI, you can add to the project the test dlls, which in turn reference the ones under test.

You can then pass that file to the NUnit console from within NAnt. e.g.

<property name="nunit.output" value="${dir.reports.nunit}\nunit-results.xml" />
<property name="nunit.input" value="proj.nunit" />

<exec program="${dir.tools}\nunit\bin\nunit-console.exe" failonerror="true">
    <arg value="${nunit.input}" />
    <arg value="/xml:${nunit.output}" />
</exec>

This way, NAnt need not know about the test dlls, just the NUnit project that contains that information.

Grant Palin