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
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
As part of the configuration I added the required targets to enable TypeMock. In BeforeTest I have TypeMockStart and in AfterTest I have TypeMockStop.

When Team Build runs the unit tests and TypeMock throws an exception that it is not enabled:

Test method MyApp.Services.Messages.UnitTests.DtoTest.Decompose_WillMapProperties threw exception:  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).


Yet when I open up the test project on the build machine and run it, everything works fine. Looking at the build log files I can see the tasks are running:

     1>Target "BeforeTest" in file "C:ProjectsMyAppMain-CIBuildTypeTFSBuild.proj" from project "C:ProjectsMyAppMain-CIBuildTypeTFSBuild.proj":
       Using "TypeMockStart" task from assembly "C:Program FilesTypemockIsolator.4TypeMock.MSBuild.dll".
       Task "TypeMockStart"
       Done executing task "TypeMockStart".
     1>Done building target "BeforeTest" in project "TFSBuild.proj".

...

     1>Target "AfterTest" in file "C:ProjectsMyAppMain-CIBuildTypeTFSBuild.proj" from project "C:ProjectsMyAppMain-CIBuildTypeTFSBuild.proj":
       Using "TypeMockStop" task from assembly "C:Program FilesTypemockIsolator.4TypeMock.MSBuild.dll".
       Task "TypeMockStop"
  1:17>CoreTestConfiguration:
       Task "TestToolsTask" skipped, due to false condition; ( '$(IsDesktopBuild)'=='true' and '$(V8TestToolsTask)'!='true' and '@(LocalTestContainer)' != '' ) was evaluated as ( 'false'=='true' and 'false'!='true' and '' != '' ).
  1:17>Done building target "CoreTestConfiguration" in project "TFSBuild.proj".
  1:17>Target "TestConfiguration" in file "C:Program FilesMSBuildMicrosoftVisualStudioTeamBuildMicrosoft.TeamFoundation.Build.targets" from project "C:ProjectsMyAppMain-CIBuildTypeTFSBuild.proj":
       Building target "TestConfiguration" completely.
       No input files were specified.
  1:17>Done building target "TestConfiguration" in project "TFSBuild.proj".
  1:17>Done Building Project "C:ProjectsMyAppMain-CIBuildTypeTFSBuild.proj" (TestConfiguration target(s)).
  1:16>Done executing task "MSBuild".
  1:16>Done building target "RunTest" in project "TFSBuild.proj".
  1:16>Done Building Project "C:ProjectsMyAppMain-CIBuildTypeTFSBuild.proj" (RunTest target(s)).
     1>Done executing task "TypeMockStop".


Any thoughts on why this might be failing?

Thanks,
Colin
asked by colinbo (1.8k points)

3 Answers

0 votes
Colin,

Can you post here the part of the build script that uses the Typemock tasks?

Thanks,
Doron
Typemock Support
answered by doron (17.2k points)
0 votes
Can you post here the part of the build script that uses the Typemock tasks?


I can't because there is nothing to post. Team Build runs the tests as part of its default test run.
answered by colinbo (1.8k points)
0 votes
Colin,

Can you try to add the <TypeMockStart> / <TypeMockStop> tasks directly to the target running the tests? See this example from our documentation:
<Target Name="TestWithTypeMock">
   <TypeMockStart/>        
      <Exec ContinueOnError="true" Command="$(NUnit) Test.dll"/>
   <TypeMockStop/>    
</Target>

See this page for the full details: https://www.typemock.com/Docs/UserGuide/ ... Build.html.

If this works, we may have a problem with running our set up as part of a separate target.

Thanks,
Doron
Typemock Support
answered by doron (17.2k points)
...