Reputation: 443
I have enabled the code coverage in the build definition for a project in TFS.
It's building as expected, unit tests are running as well but code coverage shows "No build coverage data available" see the screenshot below.
Any help is appreciated.
Upvotes: 11
Views: 6441
Reputation: 21
The problem can be solved by checking two check boxing as shown in the picture only enabling Code Coverage is not enough you need to check Upload test attachments as well in the Test Template.
Upvotes: 0
Reputation: 1062
The coverage result is just a file with *.coverage
extension.
So enabling Code Coverage Enabled
checkbox is not enough.
This checkbox enables calculating of code coverage and producing this file.
However to attach this *.coverage
file to a build, you also need to enable Upload Test Attachments
checkbox under Reporting Options
section.
Please see the image attached.
This checkbox enables exactly what you need, it will publish coverage result against with the build.
And the final log should look something like this:
2016-10-17T15:47:03.6834453Z Attachments:
2016-10-17T15:47:03.6834453Z TFSBUILD 2016-10-17 11_46_53.coverage
2016-10-17T15:47:03.6834453Z Total tests: Passed: Failed: Skipped:
2016-10-17T15:47:03.6834453Z Test Run Successful.
Upvotes: 6
Reputation: 31075
Just test on my side, Code Coverage is available as expected. I'd like to share my steps for your reference:
Create a default Visual Studio template.
Specify the Solution in Visual Studio Build
task, and check the Code Coverage Enabled in Visual Studio Test
task. See the screenshots below:
Other settings are not changed.
By the way, I'm using TFS 2015 Update2.
Upvotes: 4