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
Hi


failed:
*** TypeMock.NET needs to be linked with Coverage Tool to run, to enable do one of the following:
1. link the Coverage tool through the TypeMock 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.NET topic)
TypeMock.TypeMockException
Message:
*** TypeMock.NET needs to be linked with Coverage Tool to run, to enable do one of the following:
1. link the Coverage tool through the TypeMock 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.NET topic)
Source: TypeMock
StackTrace:
at TypeMock.MockManager.Init(Boolean collectAllCalls)

that message is the same even if i use the testdrven menu test with typemock

thnks
asked by tolisss (28.8k points)

27 Answers

0 votes
From what you dexribe it seems that something messes the registry during your tests.

Is by any change you are using code coverage tools?

Also can you post the part of the msbuild file that contain the usage of typemock that may also contain some info that may help.

Regarding the last problem you have we will need to check it and see what may cause such a problem. :?
answered by lior (13.2k points)
0 votes
Hi,

I am not using any code coverage tools.

I'd be happy to post any part of a msbuild file that might help but I'm not sure what you're looking for. The problems that I am having are within Visual Studio and as far as I know my VS project file (which of course uses msbuild) doesn't have any TM stuff in it.

On the other hand if you're asking about any build automation scripts that I have and run I can provide those but those don't seem to be having any issues.

Do you think that the automation scripts (which do use TM) are affecting the VS.NET integration with TM?

Let's just work on this one problem for now and we can return to the tmService issue later.

Cheers,

Darin
answered by Darin_Creason (3.5k points)
0 votes
Hi,

Do you think that the automation scripts (which do use TM) are affecting the VS.NET integration with TM?


Actually I do. From the error you describe it looks like something is messing up the registry from time to time.

Can you post the msbuild script that you run from command line?
Im specifically looking for the parts which are using the any Typemock Isolator tasks.
answered by lior (13.2k points)
0 votes
I think you might be right. I haven't proven it scientifically but observationally the problem seems to occur if I combine the command line msbuild with a build and test within VS.NET.

Here is the portion of the script that gets run when I run unit tests.

    <Target Name="RegisterTypeMock">
       <TypeMockRegister Company ="Transcore Commercial Services" License="<intentionallyleftout>" AutoDeploy="True"/>
    </Target>

    <!-- This target will run the NUnit tests specified in @(TestAssemblies) -->
    <Target Name="RunTests" DependsOnTargets="CopyFiles;RegisterTypeMock">

        <CreateItem
            Include="$(SandboxDir)TransCore.*.UnitTests.dll" >
            <Output
               TaskParameter="Include"
               ItemName="TestAssemblies"/>
        </CreateItem>

        <RemoveDir
            Directories="$(TestResultsOutputDir)" ContinueOnError="true" />

        <MakeDir
            Directories="$(TestResultsOutputDir)" ContinueOnError="false" />

        <TypeMockStart Target="2.0" loglevel="1" logpath="$(TypeMockPath)" />

        <NUnit
            Assemblies="@(TestAssemblies)"
            ToolPath="$(NUnitPath)"
            OutputXmlFile="$(TestResultsOutputDir)%(filename)$-results.xml"
            ContinueOnError="false">
        </NUnit>

        <TypeMockStop Undeploy="True" />

        <CreateItem
            Include="$(TypeMockPath)*.out"
            >
            <Output
               TaskParameter="Include"
               ItemName="TypeMockLogFiles"/>
        </CreateItem>

        <Delete Files="@(TypeMockLogFiles)" />

    </Target>

    <Target Name="RunTestsAndCreateTestReport" DependsOnTargets="RunTests;CreateTestReport" />

    <!--
        This target will use whatever tests results files have been output in the test directory
        and transform them into a test report using XSLT
    -->
    <Target Name="CreateTestReport" >
        <CreateItem
            Include="$(TestResultsOutputDir)*$-results.xml" >
            <Output
               TaskParameter="Include"
               ItemName="XmlResultsFiles"/>
        </CreateItem>

        <Xslt Inputs="@(XmlResultsFiles)" Xsl="@(nunitReportXslFile)" Output="$(TestResultsOutputDir)TestReport.html" />
    </Target>


-D
answered by Darin_Creason (3.5k points)
0 votes
hi,

Thank you for the details.
I'll need to look deeper into this in order to see what is wrong.

My suspicion is that the problem you are seeing happens after failure during the build which somehow causes the build to skip the "undeploy" operation at the end of the run. Leaving the registry in an "unclean" state.

If possible try to change the NUnit task ContinueOnError property to true and see if that helps you or not.

If this indeed solves the issue we shall need to investigate a more proper method for handling these cases.
answered by lior (13.2k points)
0 votes
I've always had a little trouble if I do TypeMockRegister on a box that already has Typemock installed. In my blog entry on getting Typemock working in your build you'll see that I have a Condition attached to my TypeMockRegister task that checks to see if a $(DeveloperBuild) property is true (which, by default, it is - the CI build box sets that to false). If it's a developer build, we skip the TypeMockRegister call.

<TypeMockRegister
Company="YOUR COMPANY"
License="YOUR LICENSE"
AutoDeploy="true"
Condition="'$(DeveloperBuild)'!='true'"/>


That might be something to try out in your build.
answered by tillig (6.7k points)
0 votes
Thanks Travis. That was a simple and good workaround. :)
answered by Darin_Creason (3.5k points)
...