Skip to content

Integration

Daniel Palme edited this page Jul 30, 2018 · 50 revisions

VSTS

  1. Setup a VSTS build agent which runs on your machine: https://YOURACCOUNT.visualstudio.com/CoverageTest/_admin/_AgentQueue

  2. Commit/Push your project to VSTS.
    I created this sample project: VSTS_CoverageSample.zip
    It contains a .NET class library and a test project based on xUnit. It also contains two bat files which:

  3. Setup of build definition in VSTS. In this case I used the ".NET Desktop" template and made some modifications:

    • Removed the VsTest step
    • Added a Batch Script step after Build solution which executes the bat file with the following command: RunTests_$(BuildConfiguration).bat
      VSTS - Bat
    • Added a Publish Test Results step after Publish symbols path. This uploads the xUnit results to VSTS
      VSTS - Test results
    • Added a Publish Code Coverage Results step after Publish Test Results using the following configuration:
      VSTS - Publish code coverage
    • Overall build order:
      VSTS - Build order
  4. Execute build and see results
    VSTS - Build result

See also this article by @dotnetfer.

TeamCity

Navigate to General Settings of your Build Configuration Settings and add the following artifact path:

TARGETDIRECTORY_OF_REPORTGENERATOR/*.* => Coverage.zip

Now you can download the full report as a ZIP archive and also browse the report in TeamCity.

Jenkins

Navigate to the Configure page of your project and add the following artifact path:

TARGETDIRECTORY_OF_REPORTGENERATOR/*.*

Now you download the full report as a ZIP archive and also browse the report in Jenkins.

You can also use the HTML Publisher Plugin.

By default Jenkins is very restrictive about JavaScript. If you use the default CSP rules you will only see a static report.
If you wish to use the JavaScript based dynamic features, then you have to change the CSP settings in Jenkins.
Navigate to the Jenkins Script Console and execute the following command:

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-scripts allow-same-origin; default-src 'self';")

CruiseControl .NET

See this tutorial: http://www.palmmedia.de/Blog/2012/9/27/cruisecontrol-net-integration-of-coverage-reports

Clone this wiki locally