SpecFlow icon indicating copy to clipboard operation
SpecFlow copied to clipboard

Cannot get code coverage reports for SpecFlow to generate

Open jwenger100 opened this issue 1 year ago • 0 comments

SpecFlow Version

3.9.74"

Which test runner are you using?

xUnit

Test Runner Version Number

<PackageReference Include="xunit" Version="2.4.2" />

.NET Implementation

.NET 6.0

Project Format of the SpecFlow project

Sdk-style project format

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Visual Studio Test Explorer

SpecFlow Section in app.config or content of specflow.json

N/A

Issue Description

I am trying to generate a code coverage report, I am interested to find out what % of lines are covered in each one of my projects within this solution. I have tried using the built in code coverage with Xunit, along with coverlet nuget package and I cannot get reports to generate with any data in them. They generate but are empty. Is there a recommended approach for accomplishing this?

Steps to Reproduce

  1. Run this command to execute the specflow tests, coverage should be generated but is not accurate.
  2. dotnet test --filter "FullyQualifiedName~IntTests" -p:CollectCoverage=true -p:CoverletOutputFormat=\"json,opencover\" -p:MergeWith="pwd/coverage.json" --logger "trx;LogFileName=TestResults.trx"

Link to Repro Project

No response

jwenger100 avatar Jan 09 '24 23:01 jwenger100