Replies: 3 comments
-
|
In your XUnit version are you using the mtp-v2 version? I have done a similar XUnit v3 MTP 2 migration to TUnit to compare the results, using Microsoft.Testing.Extensions.CodeCoverage as my package, and I do not see a difference in the reported covered lines or branches. This is when ran via CLI and CI pipeline. That said, in my case I'm dual targeting just net8 and net10. |
Beta Was this translation helpful? Give feedback.
-
|
We hit this exact signature this week and confirmed the trigger. Posting in case useful for narrowing your case. Reproduction
TriggerThe failing sub-project referenced <Deterministic>false</Deterministic>
<DeterministicSourcePaths>false</DeterministicSourcePaths>for any project that pulls Verify in. The MSBuild binary log confirms this empirically: Confirming experimentAdding Design tension caveatThe override is not a usable fix. Verify needs the non-deterministic absolute source paths in PDBs to locate In our case we have accepted the trade-off of leaving snapshot tests out of coverage measurement (our snapshot tests verify serialised output rather than code-path behaviour, so the lost signal is bounded for us). Whether that trade-off is acceptable for any given project depends on what its snapshot tests are checking. Worth checking for your caseDoes your project (or any sub-project) reference Verify? If yes, the same Caveat we have not explainedWe do not yet understand why local Docker on the exact same image does not reproduce the empty cobertura. Same SDK, same package versions, same coverage settings, same |
Beta Was this translation helpful? Give feedback.
-
|
Sorry I never saw this! The code coverage package and functionality is supplied by Microsoft, so unfortunately I have the rubbish answer of I don't know why it's different! Should be able to ask here though: https://github.com/microsoft/codecoverage |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
My TUnit test project targets 4 frameworks (net472, net8.0, net9.0, net10.0). In a test run, each produce a cobertura.xml file, but only one is non-empty.
https://github.com/AArnott/Nerdbank.MessagePack/actions/runs/20447346767/job/58753319027?pr=834#step:6:788
The 3 that are empty all look like this:
That's the whole file.
I believe this underreporting is why in my xunit to tunit migration, I've reportedly lost about 5% code coverage.
Do you know why this is happening?
When I run tests within VS with code coverage enabled, the coverage numbers are... different. But they must somehow be counted quite differently. The product code (which doesn't change at all across the xunit-to-tunit migration) allegedly is made up of a different number of code blocks.
Here is the in-IDE coverage numbers of a product class before and after the migration (both as seen on a .NET 9 test run):
These don't add up to the same numbers when you add covered and non-covered things.
Beta Was this translation helpful? Give feedback.
All reactions