NAnt not running NUnit tests

Posted by ctford on Stack Overflow See other posts from Stack Overflow or by ctford
Published on 2009-12-29T17:08:42Z Indexed on 2010/03/23 22:23 UTC
Read the original article Hit count: 425

Filed under:
|
|

I'm using NUnit 2.5 and NAnt 0.85 to compile a .NET 3.5 library. Because NAnt 0.85 doesn't support .NET 3.5 out of the box, I've added an entry for the 3.5 framework to NAnt.exe.config.

'MyLibrary' builds, but when I hit the "test" target to execute the NUnit tests, none of them seem to run.

[nunit2] Tests run: 0, Failures: 0, Not run: 0, Time: 0.012 seconds

Here are the entries in my NAnt.build file for the building and running the tests:

<target name="build_tests" depends="build_core">
    <mkdir dir="Target" />
    <csc target="library" output="Target\Test.dll" debug="true">
        <references>
            <include name="Target\MyLibrary.dll"/>
            <include name="Libraries\nunit.framework.dll"/>
        </references>
        <sources>
            <include name="Test\**\*.cs" />
        </sources>
    </csc>

</target>

<target name="test" depends="build_tests">                
    <nunit2>
        <formatter type="Plain" />
        <test assemblyname="Target\Test.dll" />
    </nunit2>
</target>

Is there some versioning issue I need to be aware of? Test.dll runs fine in the NUnit GUI.

The testing dll is definitely being found, because if I move it I get the following error:

Failure executing test(s). If you assembly is not build using NUnit 2.2.8.0... Could not load file or assembly 'Test' or one of its dependencies...

I would be grateful if anyone could point me in the right direction or describe a similary situation they have encountered.

Edit I have since tried it with NAnt 0.86 beta 1, and the same problem occurs.

© Stack Overflow or respective owner

Related posts about nant

Related posts about nunit