New to Telerik JustMock? Download free 30-day trial

Cruise Control .NET

CruiseControl.NET is a free and open source software tool for automating software build processes. It targets the .NET environment. CruiseControl.NET (also known as "ccnet") uses pure XML in its config files where you can assemble tasks in order to build your project.

This article explains how the JustMock Runner is integrated inside the ccnet configuration file, so that it can execute the tests inside your solution.

You can learn more about CruiseControl.NET at their official website or sourceforge.

CruiseControl.NET and JustMock Runner

We will be using the Telerik.JustMock.CSExamples.VS2010.sln (found in the JustMock root folder under Examples) to show the process of integrating JustMock with Cruise Control.

To build the solution with ccnet we first have to add the appropriate entries inside the ccnet.config file, which can be found in the CruiseControl.Net root folder (ex: C:\Program Files (x86)\CruiseControl.NET\server).

Start by adding a new project, like the example below:

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
      <!-- This is your CruiseControl.NET Server Configuration file. Add your projects below! -->

      <project>
      <name>MyProjectWithJustMock</name>
      <workingDirectory>C:\Program Files (x86)\Telerik\JustMock\ExamplesNew</workingDirectory>
      <webURL>http://localhost/ccnet/server/local/project/MyProjectWithJustMock/ViewProjectReport.aspx</webURL>
      <modificationDelaySeconds>2</modificationDelaySeconds>

      <state type="state" directory="C:\Program Files (x86)\CruiseControl.NET\server\State" />

To check if the tests in your project are passing or failing you will need to add a publisher like this:

<publishers>
      <merge>
      <files>
      <file>C:\Program Files (x86)\CruiseControl.NET\server\Log\ccnet.xml</file>
      </files>
      </merge>
      <xmllogger />
      </publishers>

After this we will add the tasks:

<tasks>

      <devenv>
      <solutionfile>Telerik.JustMock.CSExamples.VS2010.sln</solutionfile>
      <configuration>Debug</configuration>
      <executable>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com</executable>
      <buildTimeoutSeconds>60</buildTimeoutSeconds>
      </devenv>

      <exec>
      <executable>C:\Program Files (x86)\Telerik\JustMock\Libraries\JustMockRunner.exe</executable>
      <baseDirectory>C:\Program Files (x86)\Telerik\JustMock\Examples\Telerik.JustMock.Tests\bin\Debug</baseDirectory>
      <buildArgs>"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" /testcontainer:Telerik.JustMock.Tests.dll</buildArgs>
      <buildTimeoutSeconds>120</buildTimeoutSeconds>
      </exec>

      </tasks>

The first task is setting the path to Visual Studio (devenv.com) and our solution file. The second is the task that actually executes the JustMock Runner.

Finally you will be able test if everything is working as expected.

  1. Open any browser and go to the following URL: http://localhost/ccnet/server/local/project/MyProjectWithJustMock/ViewProjectReport.aspx

    Cruise Control.NET 1

  2. Build your project and check if the tests in it have passed or failed.

    Cruise Control.NET 2

See Also

In this article