Tools to view code coverage results of MSTest in Jenkins - mstest

Are there any tools available to see the MSTest code coverage results in Jenkins?

Here's a link to an XSLT that can transform the XML into some nice HTML:
http://dbebek.wordpress.com/continuous-integration/xslt-for-mstest-code-coverage/

Related

Find test that provided code coverage to a portion of code in VS 2019

I am making changes to an existing code base and ran Visual Studio Code Coverage tool to obtain code coverage against all tests in the test project. I see that areas that have code coverage are highlighted. However, is there an easy way to find which test provided coverage for a portion of code?
Visual Studio CodeLens provides a feature called Associated Unit tests which shows all unit tests associated with the method. This was what I was looking for.

TeamCity 9.0.1 - not all assemblies show in Coverage Breakdown

I have a Visual Studio solution consisting of several projects. I set a build process for it in TeamCity, and I have added a an NUnit runner build step, with these settings:
nunit runner 2.6.3
run tests from: %teamcity.build.workingDir%\Sources\**\bin\*.Web.UnitTests.dll
.net coverage tool: JetBrains dotCover
Filters: --empty--
In the Code Coverage tab of the build, under Coverage Breakdown, I can only see:
MyProject.Domain
MyProject.Web.UnitTests
MyProject.Web, the object of the tests, and a few other assemblies in the solution are not displayed there, and are ignored by the dotCover code coverage calculations. Why? How can I tell it which assemblies to use?
I've unsuccessfully tried various +: / -: combinations in the Filters field. But with Filters empty, I am expecting MyProject.Web to be included, since MyProject.Domain is - why isn't it included?
Are you building in Release or Debug mode? I had the same problem with Release mode and had to enable PDB output which is what dotCover requires to determine the code coverage. PDB is not enabled by default for Release builds.
To enable it go to Project Settings -> Build -> Advanced (button at the bottom) -> Debug Info -> Choose "pdb-only" or "full".
Additionally, dotCover provides this statement when no code coverage can be determined. It may be helpful to check all of the reasons listed:
No executable code was detected.
The issue could be caused by one of the following:
Include / exclude patterns are incorrect
Assemblies are compiled without debugging information
.pdb files are not available
Visual Studio code coverage is enabled for MSTest
.testrunconfig is used for MSTest and Visual Studio code coverage is not disabled (CodeCoverage section with enable="true" is present)
I'm afraid without log files and your snapshot it will be difficult to provide the right answer. Please submit a request and attach the files: http://dotnettools-support.jetbrains.com/anonymous_requests/new
If logs are not enabled yet, add the corresponding parameter to your build configuration to activate them: https://confluence.jetbrains.com/display/TCD9/Reporting+Issues#ReportingIssues-dotCoverIssues

Sonar is not able to produce coverage through Visual studio XML coverage files

Here are some of the steps i followed:-
I am using SonarQube 4.3 with C# 3.2
1) I run a command on one of our solutions to produce the Coverage XML. This coverage XML is produced by running Coverage.exe (Visual Studio Coverage tool) on the test dll.
2) Then, I run sonar with the command to import this coverage XML into sonar as per new rules.
3) At the end,Sonar Analysis is successful but coverage never comes up.
Can someone tell me why the coverage doesn't come up? The new Sonar wants Coverage XML to be produced independently and then to be imported into the dashboard. C# 3.2 plugin supports this type of import and coverage XML.

VS2012 professional Code Coverage

I´m searching for a way to generate code coverage reports on VS2012 professional and using Nunit. I know that VS2012 ultimate have a code coverage tool and with Nunit_Adapter you can generate the code coverage report, but the issue is that I am using VS2012 professional and does not have the option to generate the code coverage report.
Does someone knows a plug-in or a relative simple way to creates this reports on VS2012 professional?
Thanks,
P.S And if someone knows a way to creates this reports using Nunit framework on VS2010 it could be an option.
Or if you want free (opensource) you can try OpenCover which is available as a nuget package and use ReportGenerator to generate some nice reports.
You'll need a third party code coverage tool, such as NCover or dotCover.

xUnit + Gallio + code coverage in Visual Studio 2010

I'm trying to find a way to migrate from mstest to xunit and still benefit from the IDE integration which made me choose mstest in the first place. Gallio seems to accomplish this noble goal, plus it's free (don't want Reshaper or TestDriven.net). But I can't get code coverage to work.
My solution contains of two projects: project SUT (the assembly I need to test) and project SUT.Tests which is a VS test project (this allows Gallio to display xunit tests in VS's Test View). I have code coverage enabled in Local.testSettings for SUT.dll and instrumentation is in place. After the test run completes there is no code coverage. Code Coverage Results window reports: Empty results generated: none of the instrumented binary was used. Look at test run details for any instrumentation problems. Unfortunately the test run details do not contain any "instrumentation problems". I tried unchecking the instrument assemblies in place checkbox and re-running the unit test; same result.
Any idea what's wrong?
My setup:
- Windows 7 x64
- VS 2010 Premium (SP1)
- xUnit 1.8
- Gallio 3.3.1 x64 (installer, not zip)
Apologies for answering my own question:
Turns out Gallio loads SUT.dll from SUT.Tests\Bin\Debug rather than SUT\Bin\Debug. I added this path to code coverage details, selected it instead of the default SUT.dll path and now it works! This is better described at here, towards the end of the post.

Resources