Search code examples
unit-testingmsbuildcontinuous-integrationteamcitytypemock

Getting teamcity to run unit tests using typemock


i am new to TeamCity and i am trying to configure it to build and run all the unit test in the solution. it is working fine for the test which are not using TypeMock but its failing for those which is using TypeMock.

i have gone through a lot of posts on typemock.org and stackoverflow too but i didnt get any clear step by step solution to fix this.

What i did yet is

added the list of assemblies which i am using

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MsTest.exe
C:\TeamCity\AutoDeploy\TypeMock.dll
C:\TeamCity\AutoDeploy\TypeMock.MSBuild.dll
C:\BuildAgent\work\d0c2681a8633b717\www.Domain.Tests\bin\Release\qqq.Domain.Tests.dll

i am missing some build configuration but i am not sure if i have to do it for MSTest too


Solution

  • Disclaimer I work at Typemock.

    The best solution in your case is to use some kind of a build script like MSBuild or nant
    If you are not using a build script you can set the TeamCity process to run with Isolator enabled. Here are the steps to do this:

    • In TeamCity projects page go to project you wish to change and hit Settings.
    • In the settings page go to the build parameters and choose edit.
    • In edit page choose add new parameter.
    • In the edit box in the Type section select Environment variable (env.)
    • In the Name text box put Cor_Enable_Profiling
    • In the value text box put 0x1
    • Hit the Save button

    Repeat the steps above one more time but change the name of the environment variable to COR_PROFILER and the value to {B146457E-9AED-4624-B1E5-968D274416EC}

    This will cause the TeamCity and its child processes (like msbuild) to run profiled with Isolator. Again, I don't think this is the best solution but it should do the job for you.