Starting SmartRunner

The SmartRunTest task starts SmartRunner.

To deploy Isolator Server and run SmartRunner:

Create a 'Typemock' folder in your source repository.

Copy 'AutoDeploy' directory from "<Typemock installation folder>\BuildScripts\" to "<repository>\Typemock\"

Copy content of "<Typemock installation folder>\BuildScripts\MSBuild" to "<repository>\Typemock\AutoDeploy".
The content of AutoDeploy folder with MSBuild:

Add the SmartRunTest task to the project file with the following optional parameters:

Parameter

Description

Type

Mandatory/Optional

TypeMockLocation

The TypeMock path

String

Mandatory

TestAssemblies

The test assemblies to load tests from

String

Mandatory

CoveredAssembly

The assembly to get coverage information for

String

Mandatory

CoverageOutput

The file to write coverage output to

String

Optional

EnableBranchCoverage

If true the branch coverage is enabled

Boolean

Optional

TestNames

The names of tests to run

String

Optional

TestResultDirectory

The result file directory

String

Optional

ResultsFile

The overriding default results filename

String

Optional

ResultsFormat

The tests output format: Nunit, MsTest or Typemock (default)

String

Optional

CoverageReportTypes

The coverage reports output formats: Text, Html, Csv, PngChart, Xml, Total, Cobertura, TeamCity, NCover. For example, the reports in Html, Text and Cobertura: "Html,Text,Cobertura"

String

Optional

LogPath

The path to write diagnostic logs

String

Optional

LogMocking

Mocking diagnostic logs, saved to LogPath. If true mocking logs are enabled

Boolean

Optional

LogRunner

SmartRunner diagnostic logs, saved to LogPath. If true SmartRunner logs are enabled

Boolean

Optional

Register

Typemock license key (company and key)

String

Optional

For example:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
      <TypeMockLocation>C:\Repository\Dependencies\Typemock\AutoDeploy</TypeMockLocation>
    </PropertyGroup>

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

    <Target Name="TestWithTypeMock">
      <SmartRunTest TypeMockLocation="$(TypeMockLocation)" TestAssemblies="$(OutputPath)\Tests.dll" CoveredAssembly="$(OutputPath)\Assembly.dll" 
        CoverageOutput="$(OutputPath)\Coverage.txt" CoverageReportTypes="Html" Register="(Company) (Key)"/>
    </Target>
</Project>
            

Run MSBuild, for example:

msbuild UnitTestsProject.csproj /t:TestWithTypeMock
                

Related topic: Auto-Deploy.