2

As part of the TFS Build we execute tests that generate trx files. I would like to execute on these set of files code coverage analysis using OpenCover, without re-executing the Unit Tests. Is there a way to do so?

Thanks

Esther Fan - MSFT
  • 8,276
  • 4
  • 27
  • 25
Arieltk
  • 121
  • 2
  • 9

2 Answers2

1

This is a little command-line & duck-tape but it gets the OpenCover and Test results in 1 pass, and publishes test results and coverage to TFS or Visual Studio Team Services (previously VSO).

  • Create .bat file Run-Tests.bat that calls vstest.console.exe to test your code with the /logger:Trx option
  • Run the tests
    • OpenCover.Console.exe -target:"Run-Tests.bat" -output:"OpenCover.xml"
  • Run OpenCoverToCoberturaConverter:
    • OpenCoverToCoberturaConverter.exe -input:OpenCover.xml -output:Cobertura.xml
  • Publish the test results and coverage to TFS:

enter image description here

enter image description here

Community
  • 1
  • 1
Andy Joiner
  • 5,932
  • 3
  • 45
  • 72
0

Unfortunately not - OpenCover needs to instrument your code as it runs in order to determine which bits of code were executed.

Shaun Wilde
  • 8,228
  • 4
  • 36
  • 56