How to start build use TypeMock ?

666 views Asked by At

i use typemock for unit test. how to start build use typemock. can i only use typemock and msbuild ? otherwise should i use nunit-console.exe ?

when I start up build with unit test... where is the my bug ?

<Import Project="C:\Program Files (x86)\Typemock\Isolator\7\TypeMock.MSBuild.Tasks" />

  <Target Name="BeforeTest">
    <TypeMockStart LogPath="C:\TypeMockLogs" LogLevel="9" Target="3.5" />
    <Exec ContinueOnError="false" WorkingDirectory="$(SolutionRoot)" Command="$(NUNIT) \bin\Debug\Business.Tests.dll" />
  </Target>
  <Target Name="AfterTest">
    <TypeMockStop Undeploy="true" />
  </Target>

  <PropertyGroup>
    <TypeMockLocation>C:BuildIsolator</TypeMockLocation>
    <NUNIT>"C:\Program Files (x86)\NUnit 2.6\bin\nunit-console.exe"</NUNIT>
    <TMockRunnerPath>"C:\Program Files (x86)\Typemock\Isolator\7\TMockRunner.exe"</TMockRunnerPath>
    <MSTestPath>"D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe"</MSTestPath>
  </PropertyGroup>
1

There are 1 answers

0
Elisha On BEST ANSWER

In order to run tests with MSBuild you need to use TypeMockStart & TypeMockStop tasks or instead use TMockRunner. The Simpler way is to use Start & Stop:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TypeMockLocation>C:\Program Files\TypeMock\Isolator\5.0</TypeMockLocation>
        <NUnit>"C:\Program Files\NUnit\bin\nunit-console.exe"</NUnit>
    </PropertyGroup>

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

    <Target Name="TestWithTypeMock">
        <TypeMockStart/>
        <Exec ContinueOnError="true" Command="$(NUnit) Test.dll"/>
        <TypeMockStop/>
    </Target>

</Project>

This example assumes the build agent has Isolator installed. If it's not, you also need to call register task prior to Start, you can find the documentation to it here

<TypeMockRegister Company ="TypeMock" License="TypeMockLicense" AutoDeploy="True"/>

Disclaimer - I work at Typemock