R – MbUnit cannot recognize test assemblies compiled with MSBuild on Windows Server 2003

cruisecontrol.netmbunitmsbuildwindows-server-2003

I've recently installed MbUnit version 2.4.2.355 on our build server which runs via Cruise Control.NET and NAnt, on a Windows Server 2003 machine with .NET Framework 3.5 SP1 installed.

I've checked every nook and cranny of the build scripts, and the NAnt output report on CC.NET tells me that the test project builds fine.

This is the NAnt script:

<target name="compiletests" description="Compiles unit tests separately">
    <exec program="${netframework.dir}\msbuild.exe">
        <arg line="C:\dev\PROJ3.1\trunk\src\PROJ\Customer\CustomerUnitTests\Company.CustomerUnitTests.csproj  /t:Rebuild /p:Configuration=Debug"></arg>
    </exec>
</target>

And the output is the ff:

[exec] Company.CustomerUnitTests ->
C:\dev\PROJ.1\trunk\src\PROJ\Customer\CustomerUnitTests\bin\Debug\Company.CustomerUnitTests.dll
[exec] Done Building Project
"C:\dev\PROJ.1\trunk\src\PROJ\Customer\CustomerUnitTests\Company.CustomerUnitTests.csproj"
(Rebuild target(s)). [exec] Build
succeeded. [exec]
"C:\dev\PROJ3.1\trunk\src\PROJ\Customer\CustomerUnitTests\Company.CustomerUnitTests.csproj"
(Rebuild target) (1) ->

What this means is that the build of the unit test assembly succeeded.

Thing is, at the end of the NAnt outputs is this:

mbunit-tests: [mbunit] MbUnit
2.4.2.355 test runner [mbunit] No test assemblies found in test

I've gone console and tried using MbUnit.Cons.Exe to manually test the compiled assemblies. The results went like this:

  • Test assemblies built using my Windows XP SP3 machine were properly recognized and the tests were being run properly on my machine, and on any other dev machine for that matter.
  • Test assemblies built in the build server running Windows Server 2003 weren't being recognized as test assemblies; I tried copying those files into my XP machine and they weren't recognized either.

I'm now wondering: what is the difference between a test assembly and a non-test assembly? I'm sure it has something to do with the Test and TestFixture attributes, but in my case, why are the assemblies compiled in WinXP machines compiled as tests, and those compiled the Win2K3 machine not recognized?

Hope someone has a clue on this.

Best Answer

First of all check this issue.
If this not help, you need to check target platform (project properties, build) to be "Any CPU". After this try to open assembly which is generated on your build machine using Reflector. May be generated files are corrupted. And also could you please try to build the project manually using VS and load generated tests in MbUnit.

Related Topic