Telerik® JustMock™ by Progress

In this article we will show you how to integrate Telerik JustMock with TeamCity.

Integrating JustMock within TeamCity using MS Build Tasks

The first possible way to integrate Telerik JustMock with TeamCity is by using JustMock MSBuild Tasks. This could be appropriate if you have predefined XML for your build process to follow.

Integrating JustMock within TeamCity using Windows Batch Command

Another approach for integrating Telerik JustMock with TeamCity is provided by the "Command Line" runner type build step in the project build configuration. To see how to execute JustMock test DLLs via the Command Prompt, refer to Windows Batch Command.

Below you will find steps to follow for running JustMock test DLLs in the TeamCity build process:

  1. Start by adding new build step with runner type: Command Line to your configuration.

    Jenkins And Team City Team City 1
  2. Having this, you are now able to configure it to execute test DLLs via the cmd.exe as shown in Windows Batch Command.

    Jenkins And Team City Team City 2

    You will simply need to pass an appropriate test execution command through the JustMockRunner.exe, which will configure the rest of the environment automatically.

    For example: "C:\Program Files (x86)\Telerik\JustMock\Libraries\JustMockRunner.exe" "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /testcontainer:"C:\Program Files (x86)\Telerik\JustMock\Examples\Telerik.JustMock.Tests\bin\Debug\Telerik.JustMock.Tests.dll"

Integrating JustMock within TeamCity using MS Test or NUnit build steps

It is also possible to achieve execution of JustMock tests with the MSTest/NUnit build step that comes from TeamCity.

  1. First you will need to create the build step:

    Jenkins And Team City Team City 3
  2. Configure its parameters:

    Jenkins And Team City Team City 4
  3. The only difference is that, to run elevated tests with JustMock, you will need to have its profiler enabled for the build process. This can be achieved, by setting the JustMock environment variables as build parameters:

    Configuration steps

    • Open "Build Parameters".

    • Click "Add new parameter".

    • As a kind, select "Environment variable (env.)".

    • One by one, add the following variables:

      JUSTMOCK_INSTANCE=1

      COR_ENABLE_PROFILING=1

      COR_PROFILER={B7ABE522-A68F-44F2-925B-81E7488E9EC0}

    Jenkins And Team City Team City Env Variables

Integrating JustMock within TeamCity using MS Test or NUnit build steps with dotCover

If you want to apply code coverage inside MSTest/NUnit build step, you will need to link the profilers first, as shown here.

Note

If you are using the dotCover shipped with TeamCity, you will need to create a build project and run it, to see the dotCover option in JustMock Configuration.

  1. Configure the MSTest/NUnit build step and add ".NET Coverage tool":

    Jenkins And Team City Team City 6
  2. Then link the profilers using the "Telerik JustMock Configuration". This is better explained here.

    Jenkins And Team City Team City 8
  3. Finally you will need to set JUSTMOCK_INSTANCE=1 as environment variable in the "Build Parameters" of your project:

    Jenkins And Team City Team City 7

See Also