chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
We have upgraded our project to .Net 4.0 and are having problems getting the Nunit tests working in TeamCity using MSBuild

We have a block of code in our MSBuild script that looks like this:
<TypeMockStart>
   <Exec  Command="path/to/nunit-console-x86.exe /path/to/Tests.dll" />
    <TypeMockStop>


This should work fine, but ever since we upgraded to .Net 4.0, I am getting this message in the logs.

Test(s) failed. TypeMock.TypeMockException :
*** Typemock Isolator is not currently enabled.
To enable do one of the following:

* To run Typemock Isolator as part of an automated process you can:
- run tests via TMockRunner.exe command line tool
- use 'TypeMockStart' tasks for MSBuild or NAnt

* To work with Typemock Isolator inside Visual Studio.NET:
set Tools->Enable Typemock Isolator from within Visual Studio

For more information consult the documentation (see 'Running' topic)
at TypeMock.MockManager.i()
at TypeMock.MockManager.Init(Boolean collectAllCalls)
at TypeMock.MockManager.h(Type A_0)
at TypeMock.MockManager.MockAll(Type type, Constructor mockConstructors)
at s.a()
at s.b()
at gv.StaticMethods[T]()
at <namespace>.<testFixture>.<testMethod>() in c:\TeamCity\buildAgent\work\5bbef895a6382114\<testClass>.cs:line 114

Does TypeMockStart work when the NUnit tests are run in .Net 4.0?
asked by jpennal (800 points)

3 Answers

0 votes
I wasn't able to reproduce this issue and I'd like to investigate this issue further - let's take it offline.
answered by dhelper (11.9k points)
0 votes
.NET 4.0 support was added to Typemock Isolator at version 6.

I see you're using version 5.4 that do not support .NET 4.0 - you need to upgrade your Isolator for it to work
answered by dhelper (11.9k points)
0 votes
Ok, I have finally got it working.

The key was two different things:
1. Upgrade to TypeMock 6.0 for .Net 4.0 support and
2. Change the way I was executing my nunit tests in msbuild. I have changed the script to look like this:
    <TypeMockStart>
      &lt;Exec Command="$(teamcity_dotnet_nunitlauncher) v4.0 x86 NUnit-2.5.3  $(DeploymentsDirectory)/tests/OpenRoad.ThoughtFarmer.Tests.dll" IgnoreExitCode="true" /&gt;
    <TypeMockStop>


This now points directly at TeamCity's nunitlauncher and everything seems to be working correctly now.
answered by jpennal (800 points)
...