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
How do I go about setting up TypeMock Isolator to enable Visual Studio code coverage when running inside of a Team Build?

I'm getting the error:
Initialization method TradingTechnologies.Applications.SupportNet.TestFixtures.BusinessLogic.TicketManagerTest.Setup threw exception. TypeMock.TypeMockException: TypeMock.TypeMockException:
*** Typemock Isolator needs to be linked with Coverage Tool to run, to enable do one of the following:
1. link the Coverage tool through the Typemock Isolator Configuration
2. run tests via TMockRunner.exe -link
3. use TypeMockStart tasks for MSBuild or NAnt with Link
For more information consult the documentation (see Code Coverage with Typemock Isolator topic).
asked by rrinaldi (1.2k points)

6 Answers

0 votes

In our guide we have a specific section on running inside the TFS.
I would start by making the test pass with no coverage
and then activating it to see what happens.
Theoretically you shouldn't need to do anything in order to make the coverage work.

If it still fail to work, let us know and we will take it offline for further investigation.
answered by lior (13.2k points)
0 votes
I'm using the targets (removed company and license info):
<TypeMockLocation>C:Program FilesTypeMockTypemock Isolator</TypeMockLocation>

<Import Project ="$(TypeMockLocation)TypeMock.MSBuild.Tasks"/>

<Target Name="RegisterTypeMock">
<TypeMockRegister Company ="" License="" AutoDeploy="True" />

<Target Name="BeforeTest">
<!-- Start TypeMock -->
<TypeMockStart />

<Target Name="AfterTest">
<!-- Quit TypeMock -->
<TypeMockStop Undeploy="True" />

I'm receive the message "Typemock Isolator needs to be linked with Coverage Tool to run" from TypeMock even if the build configuration i'm using doesn't have code coverage enabled.
answered by rrinaldi (1.2k points)
0 votes
I am getting the same error when the tests are run with NUnit. We just started using 4.2.4 with Visual Studio 2008. These tests and build scripts all run fine with Visual Studio 2005 and TypeMock 4.0.3.

When the TypeMockRegister task is run we get this error:
C:BuildDev7BuildUnitTest.Targets(14,8 ) : error MSB4018: The "TypeMockRegister" task failed unexpectedly.
C:BuildDev7BuildUnitTest.Targets(14,8 ) : error MSB4018: System.NullReferenceException: Object reference not set to a
n instance of an object.
C:BuildDev7BuildUnitTest.Targets(14,8 ) : error MSB4018: at a.b()
C:BuildDev7BuildUnitTest.Targets(14, 8 ) : error MSB4018: at TypeMock.MSBuild.TypeMockRegister.Execute()
C:BuildDev7BuildUnitTest.Targets(14, 8 ) : error MSB4018: at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstanti
atedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResul

I don't know if this matters, but this script is running on Windows 2003 Server (x64), but the build is running as 32-bit (WOW64). TypeMock is running from C:Program Files (x86)TypeMockTypemock Isolator.
answered by ksummerlin (4k points)
0 votes
Still having trouble getting this to work. Can someone please contact me so we can get this straightened out?
answered by rrinaldi (1.2k points)
0 votes

We need to take this offline. Please follow the instructions here to produce logs, and send them to support AT typemock DOT com.

Here's how to do this:
1. Turn on logging for Typemock (Program files->Typemock->Typemock Isolator->Configuration, Visual Studio integration),
2. Set a location for the logs (If not running as an administrator, create a temporary folder for that.
3. Run your build.

There should be two files created in the location you specified. Send them to us.
Hoping to resolve this quickly,
answered by gilz (14.5k points)
0 votes
I am not convinced this is TFS issue.

Also, there something that's dumping out that is obsfuscated code (see below). Is that by design or is it actually a Typemock method that is obsfuscated?

(C:BuildDev7BuildUnitTest.Targets(14,8 ) : error MSB4018: at a.b()r )

If you execute TMockRunner just the same as in the build, especially on the build server, what do you get?
answered by tbassett (1.8k points)