Resharper DotCover Analyse for Visual Studio Team Services

Do you use Visual Studio Team Services (VSTS) for Builds and/or Releases? Do you use Resharper DotCover? Do you want to use them together? Then boy do I have an extension for you!

That might be a corny introduction, but it is exactly what I have here.

In my current projects we use Resharpers, or also know as Jet Brains, DotCover to run code coverage on all our code. However to run this in VSTS there is a bit of a process to install DotCover on the server and then write a Batch command to execute it with settings. This isn’t the most complex task, but it does give you a dependency to always install this on a server, and have the written Batch script in source control or in the definitions on VSTS. This can cause issues if you forget to get it installed or you need to update the script for every project.

Therefore I got all that magic of the program and cramed it into a pretty package for VSTS. This tool is not reinventing the wheel, but putting some greese on it to run faster. The Build/Release extension simply gives you all the input parameters the program normally offers and then runs them with the packaged version of DotCover that comes with the extension. See simply.

There is however one extra bit of spirit fingers I added into the extension. When researching and running my own tests, I found that some times it is helpful to only run the coverage on certain projects, but to do this you need to specify every project path in the command. Now I don’t know about you, but that sounds boring, so I added an extra field.

Instead of in the Target Arguments passing each project separately and manually, you can pass wildcards in the Project Pattern. If you pass anything in the Project Pattern parameter it will detect you want to use this feature. It then uses the Target Working Directory as the base to recursively search for projects.

For Example: Project Pattern = “*Test.dll” and Target Working Directory = “/Source”

This will search for all DLL that end with ‘Test’ in the ‘Source’ directory and then prepend it to any other arguments in the Target Arguments.

For Example: “/Source/MockTest.dll;/Source/UnitTest.dll”

You can download the extension from the VSTS Marketplace
Here are is a helpful link for Resharper DotCover Analyse – JetBrains
Then this is the GitHub Repository for any issues or some advancements you would like – Pure Random Code GitHub

Update 20-07-2018

There was a recent issue raise on the GitHub Repository that addressed a problem I have also seen before. When running the DotCover from Visual Studio Team Services an error appears as below:

Failed to verify x64 COM object registration: Empty path to COM object.

From the issue raise, the user had linked to a Community Article about “DotCover console runner fails when running as VSTS task“, which in the comments they discussed how to fix this.

To correct it we simply add the following command to the request, that specifies what profiled process bitness to use as they say.


Therefore the task has now been updated with this field and feature to accomadate this issue and fix. It has been run and tested by myself plus the user that raised the issue, so please enjoy.

How to use Chutzpah with Visual Studio and Build?

If you want to do some JavaScript Unit testing your most probably going to use things like Jasmine, Qunit or Mocha, which are all great things, but how do you run them? This was a challenge I came upon with Visual Studio and how to get it running like a normal NUnit test.

First of all if you don’t know what Chutzpah is, it’s an Open Source Test Runner for JavaScript unit testing frameworks. It currently works with Jasmine, Qunit or Mocha, using the PhantomJS headless browser for testing. You can find out more information on these subjects with the links below:

Visual Studio Setup

To get Chutzpah set up in Visual Studio could not be easier. You simply need to install the Nuget Package from the manager. There are multiple method to do this, but the one I use is this.

  1. Open Visual Studio (version 2013 is used in the graphics)
  2. Click on ‘Tools’ from the top menu
  3. Click on ‘NuGet Package Manager’ then ‘Manage NuGet Packages for Solution…’
  4. Once the manager window pops up, search for ‘chutzpah’
  5. The results should show ‘Chutzpah – A JavaScript Test Runner’
  6. Install this NuGet package.


You now have it installed and you should see the unit testing icons next to your tests. For example, I use Qunit and it looks like this.



You will also notice if you are using Qunit that I have the ‘setup’ property in my module. This is because Chutzpah is running Qunit 1.23.1, not the latest 2.x. Therefore I would check what version testing framework you are using and if it is supported. You might want to use a different test runner or downgrade your framework.

Building with Team Foundation Server

Now I’m not going to go through how to use the TFS build definitions as this is a whole huge subject itself. However I would like to show how I got Chutzpah running on build as when researching I found only snippets scattered.

The method to do this is to run it via the command line, so I know most peoples ‘Build process templates’ will be different, but this is mine. In the build process template, I have a ‘Post-test script path’ and the arguments inputs. In these I put the commands.


As you will see I have a destination to the console exe application for Chutzpah. This is downloaded with the NuGet package and so should be in the same location for everyone. For copy and pasting people here is the destination:


As well as other parameters, the exe takes the directory location of where the tests are held. As the build would run from the root of the project, I have done the same. This is why the exe directory starts from packages and the arguments would also start from there. If you have one script you might put the file name at the end as well, but if you want to run all tests in a directory then only go as deep as you need.

You can test the running of this by opening the project directory in command line and running the same command. Quick-tip to get to the directory faster is to open it in File Explorer, then type ‘cmd’ in the address bar and click enter as below:


Once open you can run the command like this:

\packages\Chutzpah.4.3.4\tools\chutzpah.console.exe project\JsUnitTest\

You should then get the below: