Questions tagged [coverlet]

Coverlet is a .Net code coverage collector that can be used with MSTest. Use this tags for questions regarding the coverlet collector and it's usage and/or output.

75 questions
3
votes
2 answers

How to pass multi-valued arguments containing commas to a property in dotnet command line tool?

I want to run a command that includes this: dotnet test /p:Exclude=\"*Test*,*Requirement*\" The above is not the full command, but it's enough to provoke the parsing error. I am using the Coverlet NuGet package in my C# project and I want to exclude…
Claus Appel
  • 379
  • 1
  • 4
  • 13
3
votes
2 answers

Creating a test report with Azure Pipelines and Coverlet does not create the coverage.opencover.xml file

Here is my solution structure: . ├── Application ├── Application.Core ├── Application.Domain └── Application.UnitTests -> HAS codecov 1.9.0 NuGet package installed The build script works otherwise fine, but I'm unable to get it to create the…
ajr
  • 874
  • 2
  • 13
  • 29
3
votes
1 answer

How to run coverlet on .NET projects not using the Sdk style projects?

I would like to try coverlet, but the only examples I could find talk about running it through dotnet.exe. My problem is that our projects do not use the Sdk style, they are old .NET projects targeting .NET 4.7.2 How can I run coverlet with them?
mark
  • 59,016
  • 79
  • 296
  • 580
2
votes
0 answers

Coverlet msbuild /p:Exclude not able to exclude third party dlls

/p:Exclude does not seem to work for me - No matter what I try I want to exclude following third party libraries | DocoptNet | 0% | 0% | 0% | +-----------------------------------------+--------+--------+--------+ | HtmlAgilityPack | 0% | 0% | 0%…
Tejas Patel
  • 1,289
  • 13
  • 25
2
votes
1 answer

Code Coverage file contains coverage of Irrelevant assemblies does not exclude even exclude with runsettings?

The project I am working on has a test project. As part of the test run, It generates a code coverage file. It used the below command to test and generate coverage XML. dotnet test --collect:"XPlat Code Coverage" --settings…
Amal Shalika
  • 1,077
  • 1
  • 13
  • 22
2
votes
1 answer

Exclude AspNetCoreGeneratedDocument Class from coverage report in coverlet

I have this class AspNetCoreGeneratedDocument.Views_Users__AddOrUpdateUser appearring in the code coverage result for each view in the Views…
KARIM Yassine
  • 143
  • 1
  • 11
2
votes
0 answers

Coverlet is unable to instrument any modules for my test project

When running this command (using coverlet underneath): dotnet test /p:CollectCoverage=true .\My.Test.Solution.sln (also tried other variations including coverlet itself) I'm getting a lot of warnings like this one: warning : [coverlet] Unable to…
Spikee
  • 3,967
  • 7
  • 35
  • 68
2
votes
1 answer

Unable to add coverlet nuget package(s) - Version string portion was too short or too long

When I try to add coverlet.msbuild to my test project I get this error: The expression "[System.Version]::Parse('')" cannot be evaluated. Version string portion was too short or too long. …
Spikee
  • 3,967
  • 7
  • 35
  • 68
2
votes
0 answers

Upload coverage information to SonarCloud from coverlet for C# project

I'm trying to collect coverage info and publish it to SonarCloud for my C# project, using GitHub Actions as my CI pipeline. The execution is very simple, basically trying to execute tests for all projects, merging all coverage files: run: | …
Peter Lenkefi
  • 1,306
  • 11
  • 29
2
votes
1 answer

VSTest@2 Task is Updating / Overriding coverlet.runsettings and not respecting exclusions

I am trying to add code coverage to a .NET Framework 4.8 solution in Azure DevOps. I have based my approach on the questions here and here and the coverlet docs, and am successfully getting code coverage results. However this solution also contains…
ste-fu
  • 6,879
  • 3
  • 27
  • 46
2
votes
1 answer

How to output code coverage results file of solution tests to solution directory instead of test project directory

It's a very basic problem and should have a simple solution. I want to have all the code coverage results for my unit tests project in a solution to output in a single directory. Currently, all the coverage output files are being written in the…
Manish Rawat
  • 1,142
  • 1
  • 18
  • 34
2
votes
2 answers

How to make Jenkins stage fail and turn red when coverage is too low (using C# and dotnet test)?

I am using C#, coverlet.msbuild and the Jenkins Cobertura adapter. I have roughly this in my Jenkinsfile: stage ('Run unit tests') { steps { powershell "dotnet test -c:Release /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura…
Claus Appel
  • 379
  • 1
  • 4
  • 13
1
vote
1 answer

coverlet.collector not adding a .NET MAUI project to the coverage.cobertura.xml

I have a .NET MAUI project and a (Unit) Tests project in the same solution. The Tests project references the .NET MAUI project and the tests run fine. I want to also add code coverage for the .NET MAUI project. However, I am unable to get this to…
dik1977
  • 21
  • 3
1
vote
1 answer

Dotnet test coverage always null

I have an issue with test coverage. When I run this command dotnet test ../XZrcndee.sln --output ../coverage /p:CollectCoverage=true /p:CoverletOutput=results\coverage /p:CoverletOutput=..\results\coverage /p:MergeWith=..\results\coverage.json…
Udemytur
  • 79
  • 1
  • 5
1
vote
0 answers

C# code coverage for files in test project

I have a project A for which I wrote unit tests in test project UnitTests. I use MSTest. I wrote some testing utils in the file UnitTestUtils.cs which simplify testing project A. I also covered these utils with unit tests. The file structure now…
elo
  • 489
  • 3
  • 13