Skip to content

dotnet test --collect "Code Coverage;Format=cobertura doesn't seem to create a coverage file #3917

@veikkoeeva

Description

@veikkoeeva

The instructions

dotnet new mstest -o mstests
cd mstests
dotnet test --collect "Code Coverage;Format=cobertura"

do not seem to work. It creates a file with <Project Sdk="MSTest.Sdk/3.5.1"> that does not work generate a coverage file on my computer. The output to console is also just

dotnet test --collect "Code Coverage;Format=cobertura"
Restore complete (0,8s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  mstests succeeded (2,0s) → bin\Debug\net9.0\mstests.dll
  mstests test succeeded (0,8s)

Test summary: total: 1; failed: 0; succeeded: 1; skipped: 0; duration: 0,3s
Build succeeded in 4,1s

I have a bit more elaborate GitHub setup at Lumoin/Verifiable#377 and the issue seems to be the same that no output file is generated (at https://github.com/Lumoin/Verifiable/actions/runs/11203930073/job/31141727980#step:14:1, the command line ecludes XUnit still even if they aren't present, but it doesn't seem to get even that far due to there not being a file to read).

The global.json is

{
    "sdk": {
        "allowPrerelease": true,
        "version": "9.0.100-rc.1.24452.12"
    },
    "msbuild-sdks": {
        "MSTest.Sdk": "3.6.1"        
    }
}

I am not sure if this is the right place to note this, but I'm thinking at least the instructions

dotnet new mstest -o mstests
cd mstests
dotnet test --collect "Code Coverage;Format=cobertura"

should work so that a coverage file will be generated or then maybe some reason given if not. My OS is Windows 11 with the latest patches, with fi-FI settings,

> dotnet --version 
> 9.0.100-rc.1.24452.12

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions