You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug coverlet.msbuild does not work with the new testing platform server mode
To Reproduce
Create a new unit tests project using TUnit. Add coverlet.msbuild as a dependency to the project. Run with the command dotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=opencover
Expected behavior
A code coverage report is generated somewhere, anywhere.
Actual behavior
No code coverage report is generated.
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used? coverlet.msbuild and 6.0.2
* Which version of .NET is the code running on? 9.0.100
* What OS and version, and what distro if applicable? Windows 10 22H2
* What is the architecture (x64, x86, ARM, ARM64)? x64
* Do you know whether it is specific to that configuration? Uncertain.
Additional context
One of the two instrumentation targets, InstrumentModulesAfterBuild, depends on(runs after) the BuildProject target, which no longer exists under the new Microsoft Testing Platform. Therefore, instrumentation is not ran regardless of what happens.
I've found two solutions to the problem, but neither of which are extensively tested.
Recreate BuildProject, so that the instrumentation target has something to hook onto and is able to run.
Add a Directory.Build.targets in the same directory as the project, then set its contents to the following,
It doesn't matter that BuildProject is empty and does nothing, because the project build is handled by the _BuildAndInvokeTestingPlatform target.
Pass the --no-build option to dotnet test, for example, dotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=opencover --no-build. This solution depends on the other instrumentation target, InstrumentModulesNoBuild, which depends on(runs before) the VSTest target. The aforementioned target still exists on the new testing platform.
coverlet.console works, from prior testing.
The text was updated successfully, but these errors were encountered:
Describe the bug
coverlet.msbuild
does not work with the new testing platform server modeTo Reproduce
Create a new unit tests project using TUnit. Add
coverlet.msbuild
as a dependency to the project. Run with the commanddotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=opencover
Expected behavior
A code coverage report is generated somewhere, anywhere.
Actual behavior
No code coverage report is generated.
Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used?
coverlet.msbuild
and6.0.2
* Which version of .NET is the code running on?
9.0.100
* What OS and version, and what distro if applicable?
Windows 10 22H2
* What is the architecture (x64, x86, ARM, ARM64)?
x64
* Do you know whether it is specific to that configuration?
Uncertain.
Additional context
One of the two instrumentation targets,
InstrumentModulesAfterBuild
, depends on(runs after) theBuildProject
target, which no longer exists under the new Microsoft Testing Platform. Therefore, instrumentation is not ran regardless of what happens.I've found two solutions to the problem, but neither of which are extensively tested.
BuildProject
, so that the instrumentation target has something to hook onto and is able to run.Add a
Directory.Build.targets
in the same directory as the project, then set its contents to the following,BuildProject
is empty and does nothing, because the project build is handled by the_BuildAndInvokeTestingPlatform
target.--no-build
option todotnet test
, for example,dotnet test -p:CollectCoverage=true -p:CoverletOutputFormat=opencover --no-build
. This solution depends on the other instrumentation target,InstrumentModulesNoBuild
, which depends on(runs before) theVSTest
target. The aforementioned target still exists on the new testing platform.coverlet.console
works, from prior testing.The text was updated successfully, but these errors were encountered: