TeamCity code coverage with xunit

Recently I decided to set up a CI build for a project: https://github.com/hhariri/jsonfx

You may notice that it uses xunit to run tests. My goal was to set up TeamCity build with tests under xunit and code coverage.

Hopefully I noticed that xunit supports TeamCity! To make it report tests for TeamCity all you need is to add /teamcity command line argument. Amazing! (I should probably write a plugin for it to make it easier in TeamCity)

The first step I set up in my build configuration was a build with 'Visual Studio (sln)' runner. This runner did all the job to build my solution and produce all artifacts I need.

Second step is to set up xunit tests. For this I decided to use '.NET Process Runner'. I specified there path to xunit, arguments.


That was easy to set up? Right?

And now I need to setup code coverage for this xunit tests. Thanks to TeamCity .NET Process Runner, I only need to select code coverage tool to make it work. No need to do anything more:



The outcome is I have created a build configuration in TeamCity that builds solution, runs tests with xunit and gathers code coverage information without writing ANY build scripts.
comments powered by Disqus