Running Tests with TMockRunner

TMockRunner tool is provided as part of Typemock Isolator.

TMockRunner launches external programs, such as an external code coverage tool, a test runner, a memory or CPU profiler. For example, using TMockRunner, you can run mstest.exe and specify the name of the DLL to be tested.

To run tests on Linux using TMockRunner, check out Running tests on a Linux agent using TMockRunner.

To run TMockRunner:

Run TMockRunner.exe as follows:

TMockRunner.exe [-version] [-deploy ] [-register <company> <license>] [-target <version>] [-logpath <path>] [-insightPath <path>] [–link <profiler>] program [arguments...]

Parameter

Description

program

Specifies the program to be run with mocking.

arguments

Specifies a list of arguments to pass to the program.

-version

Displays the version of Typemock Isolator to the console. This parameter cannot be used with other arguments.

-deploy <path>

Install Typemock binaries from the specified path. This is the normal operation on server deployment. See Automatic Deployment.

-register

Registers Typemock Isolator with your license.

-target

Changes the version of.NET.

Possible values:

2.0

3.0

3.5

4.0

4.5

-logpath <path>

Specifies the path where log files are stored.

-insightPath <path>

Saves Typemock Insight data to (Can be opened in Visual Studio).

Advanced Options

-link <profiler>

Integrates Typemock Isolator with a specified profiler.


  TMockRunner will automatically link known profilers, this option is kept for backward compatibility

-supportPreV9Settings

Support pre v9 typemock.dll's.


  Requires admin rights - needs to be done once per machine

-supportPreV8Settings

Uses legacy registry (Machine Level)

-upgradePreV8Settings

Changes the registry to the user space.

Sample 1: Running MSTest

The following example shows how to run MS-Test for test.dll with Typemock Isolator using the binaries from the installed version.

TMockRunner mstest.exe test.dll

Sample 2: Running dotnet test

The following example shows how to run dotnet test for test.dll.

TMockRunner dotnet test test.dll

Sample 3: Running Nunit Using .NET 4.0

The following example shows how to run NUnit using .NET 4.0 for test.dll with Typemock Isolator enabled from the AutoDeploy folder.

TMockRunner -deploy "\Typemock\Isolator\9.0\BuildScripts\AutoDeploy" -target 4.0 nunit-console.exe test.dll

Sample 4: Running Code Coverage Tool with Visual Studio 2012

The following example shows how to run coverage with MS Visual Studio 2012 test runner for test.dll with Typemock Isolator enabled from the AutoDeploy folder.

TMockRunner -deploy "\Typemock\Isolator\9.0\BuildScripts\AutoDeploy" vstest.console.exe test.dll /EnableCodeCoverage /settings:CodeCoverage.runsettings

Sample 5: Running OpenCover.Console with Visual Studio 2012

The following example shows how to run OpenCover coverage with Visual Studio 2015 MSTest for test.dll with a specific settings.

Make sure you have TMockRunner in the begginig of the command.

"Typemock Installation Folder\BuildScripts\TMockRunner.exe"  OpenCover.Console.exe  
-target:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" 
-targetargs:"/testcontainer:test.dll /testsettings:settings.testsettings /resultsfile:results.trx"  
-register:user -mergebyhash

When using OpenCover do not set the -register property to -register:user because it will interfere Typemock Isolator.