question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot exclude tests in runsettings when using VSTest integration driver

See original GitHub issue

Hi! We are using the VSTest integration driver (v1.2.0) to successfully generate a coverage.covertura.xml. Integrated it with MS DevOps, everything looks great. Now we want to exclude some files from our test report and we can’t seem to get it to work.

We are running as follows: dotnet test --collect:"XPlat Code Coverage" --settings .\coverlet.runsettings and dotnet test --settings .\coverlet.runsettings.

We’ve tried many runsettings file configuration, but in its simplest form we think something like this should work:

<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="XPlat Code Coverage">
<Configuration>
<Format>cobertura</Format>
<Exclude>[*]*</Exclude>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>

We have gotten file exclusion to work with the MSBuild integration driver, using the following command: dotnet test /p:CollectCoverage=true /p:Exclude="[*]*"

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
MarcoRossignolicommented, Oct 9, 2020

Hi @mrcoymeeks you should add namespaces with a comma , like in the documentation sample https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/VSTestIntegration.md

...
 <Exclude>[coverlet.*.tests?]*,[*]Coverlet.Core*</Exclude> <!-- [Assembly-Filter]Type-Filter -->
 <Include>[coverlet.*]*,[*]Coverlet.Core*</Include> <!-- [Assembly-Filter]Type-Filter -->
...
1reaction
civspancommented, Apr 6, 2020

Thank you for your prompt response Marco. We added the logging flag and the exclusion started working as expected right away. Very strange, but most welcome! I’m sure we did something wrong before but I have no idea what. I’ll close this for now and if we detect the issue again I’ll post it here.

Thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot exclude tests in runsettings when using VSTest ...
Hi! We are using the VSTest integration driver (v1.2.0) to successfully generate a coverage.covertura.xml. Integrated it with MS DevOps, ...
Read more >
Configure unit tests by using a .runsettings file
In the IDE, select Test > Configure Run Settings > Select Solution Wide runsettings File, and then select the .runsettings file. This file ......
Read more >
xml - .runsettings - Exclude All files with 'test'
I am trying to run a build with tests using the .runsettings file in VS 2017 and I want to exclude all the...
Read more >
QA – DTan's Blog
Continuous Integration in VSTS using .Net Core (with Code Coverage), ... Use a test .runsettings file to exclude assemblies you don't want to...
Read more >
Most Complete MSTest Framework Tutorial Using .Net Core
Learn about the MSTest Framework using .Net Core in Selenium C# and the aspects related to cross browser testing and parallel testing in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found