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
1
vote
0 answers

Code Coverage int .NET 5 Web API with Coverlet

I've web Api build it .NET 5.0. Web API structure: Main Web Project (Contains controllers and other client specific data) Infrastructure Project (It has services and repositories with more business logic) Models (Db entities) Tests (Test cases…
Bharat
  • 5,869
  • 4
  • 38
  • 58
1
vote
1 answer

Threshold validation for code coverage in .net5

We have an api in .net5, we were using coverlet.msbuild to validate our code coverage but our solution has 50 csprojs and we were hitting a bug where some projects returned 0% of coverage, so we changed the package to coverlet.collector, our problem…
Juan Zamudio
  • 373
  • 11
  • 35
1
vote
1 answer

coverlet coverage report resulting in Microsoft.VisualStudio.Coverage.VanguardException

I'm trying to integrate Cobertura report generation in my azure pipeline. For that I've added coverlet.collector 3.0.3 in my .Net core test projects. Below is my yaml command for test run - task: DotNetCoreCLI@2 displayName: Test inputs: …
Pushpendu
  • 159
  • 10
1
vote
0 answers

Coverlet - dotnet test output to console

I've been playing around with coverlet. I can save the full details to a file (such as coverage.json) and I can see a summary table in the console. I cannot figure out how to see the full coverage details in the console in table format. The…
JALLRED
  • 855
  • 1
  • 11
  • 23
1
vote
0 answers

Coverage returning %NaN% when running unit tests in azure devops

I have a dot net core version: '3.0.100', building on 'ubuntu-latest' and am trying to get code coverage reports. I have been using Coverlet to generate Cobertura files which can then use the PublishCodeCoverageResults@1 to publish to the Devops…
Aditya Adi
  • 11
  • 2
1
vote
0 answers

Coverlet always returns 0 even then threshold isn't met

I am running coverlet in my Linux CI box. Right now, after I run the command below, regardless if the threshold is met or not, when I check the $? value, the command always returns 0. dotnet test -p:CollectCoverage=true -p:Threshold=95 I need…
Zorthgo
  • 2,857
  • 6
  • 25
  • 37
1
vote
2 answers

Run coverlet and reportgenerator in a macOS DevOps Pipeline

I have a C# project written in dotnet core 2.1 which I'm trying to set up an Azure Pipeline for so that I can get code coverage when running on a macOS agent (I can change to other agents, but ideally the pipeline would be system agnostic). So far I…
Ayb4btu
  • 3,208
  • 5
  • 30
  • 42
1
vote
1 answer

Code Coverage for untested projects in .net core and global threshold

I've set up a Azure DevOps CI pipeline to collect code coverage acquired by using coverlet. I've noticed that, if a project is somehow tested by a project, the report will include info regarding untested classes/code but if, for example, a developer…
0
votes
0 answers

How to get TeamCity + XUnit + Coverlet to work?

I am posting this after 2 days of trying various solutions that didn't work for me. This is mostly for my future reference, but I hope others can benefit as well. I used this source as the basis for my work, however this post was able to get…
Bitfiddler
  • 3,942
  • 7
  • 36
  • 51
0
votes
1 answer

How to get .NET code coverage analysis in VS Code?

I wrote NUnit tests to test .NET code. Now I want to see my coverage statistics in VS Code. Is there any way to get visual/textual coverage analysis for .NET unit tests in VS Code? Maybe there is some good extension for that?
Yoro
  • 805
  • 8
  • 17
0
votes
0 answers

Coverage Report in Multi-Project .NET Solution

I have a .NET solution with multiple projects, structure looks like this: -Solution -ServiceProject -ServiceProject.SomeClientproject -ServiceProject.Tests -ServiceProject.SomeClientProject.Test ServiceProject is my main project, it's a…
idanz
  • 821
  • 1
  • 6
  • 17
0
votes
1 answer

Coverlet does not generate cobertura.xml for MSTest test projects

I have a solution with multiple test projects (MSTest). I wanna check my code coverage for the entire solution. To do this, I type the following command: dotnet test --collect:"XPlat Code Coverage" "MySolution.sln" --no-build --…
Aleksej_Shherbak
  • 2,757
  • 5
  • 34
  • 71
0
votes
0 answers

XUNIT issue: reference project with unit testing class library

I have a solution with two projects and two class library with unit tests code for each project. Middleware Middleware.UnitTest WebApi WebApi.UnitTest In the WebApi Project I added as Project Reference the Middleware project because is necessary…
0
votes
1 answer

Unable to find a datacollector with friendly name 'Format=opencover' - coverlet

I already posted this on GH but as it seems to get no attention there I will try again here. Hi! I cannot for the life of me figure this one out... Below are the commands I am running in my GitLab CI/CD pipeline (Docker runner): dotnet build -c…
Matheos
  • 207
  • 2
  • 12
0
votes
0 answers

XUnit code coverage results different on CI build compared to locally

I'm presently baffled by the same command, on the same code, with the same dotnet version, producing two different results. My development machine is an ARM-based Mac, and CI is in a Docker image run from Bamboo on a CentOS host. Test coverage…
Dov
  • 15,530
  • 13
  • 76
  • 177