question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Stryker Randomly Reports NoCoverage for all mutants

See original GitHub issue

Describe the bug Stryker randomly reports NoCoverage for all non-excluded mutants.

When running against multiple projects (individually) I can almost always reproduce the problem in at least one of them by specifying max-concurrent-test-runners with a value other than the default. I was originally going to say that was necessary to reproduce the issue, but I am still getting random (though less frequent) runs reporting NoCoverage without it so concurrency may be a red herring.

These runs then break my automated builds–I have a script that collects the output from each project and combines them into a single report which fails due to missing result files.

Logs I have logs but I’d prefer not attaching them publicly as they look to contain our source code. Can I provide these directly to someone? If not, I’ll see what I can do about redacting them.

Expected behavior Stryker should detect the same coverage/no-coverage status every run.

Desktop (please complete the following information):

  • OS: Windows 10 and Ubuntu 18.04
  • Type of project: Core
  • Framework Version: 3.1/5.0 (see below)
  • Stryker Version: 0.22.9

Additional context I have a solution with five projects in it. The projects-under-test are multi-targeted .NET5.0 and .NETStandard2.1 (and in one instance, .NETCOREAPP3.1 in lieu of .NETStandard). The Test projects themselves are multi-targeted 3.1/5.0. Each project has a configuration file that looks like this:

{
	"stryker-config": {
		"reporters": [ "progress", "html", "json" ],
		"max-concurrent-test-runners": 4,
		"coverage-analysis": "perTest",
		"project-file": "The.Project.Name.csproj",
		"language-version": "CSharp9",
		"mutation-level": "Advanced",
		"ignore-methods": [ "ToString", "ConfigureAwait", "*Exception.ctor", "Log*" ],
		"excluded-mutations": [	"string" ],
		"mutate": [ "!**/Some.Exclusions.cs" ]
	}
}

For two of the test projects, specifying project-file is necessary as there are a handful of tests that validate some interactions between two of the libraries (unavoidable). For consistency I specify the project-file in all configuration files.

I run Stryker for all of the test projects, individually of course. With the above configuration I am pretty much guaranteed that at least one of the test projects will report that all tests are NoCoverage. It’s not always the same project(s). When running in my build pipeline it might be the first, it might be the third. Because the pipeline fails at the first missing result file it’s hard to say what the remaining projects would do.

If I remove max-concurrent-test-runners and rely on the default, I get a smooth run more often then not–but not always. Re-running the “failed” executions with the very same configuration will usually produce a completed run.

This is all happening in my build pipelines. I sometimes experience the same behavior locally but only when overriding the default concurrency (I have not yet experienced it locally using the defaults).

Some other notes:

  • My PC is Windows 10 with .NET Core 3.1, .NET 5.0 and 6.0 Preview installed.
  • My Build agents are Ubuntu 18.04 and have 3.1/5.0
    • For some reason Stryker always goes single-threaded on the Linux VMs, despite having 8 cores, which is why I was specifying the concurrency value
  • Every run of Stryker (locally and on VMs) also produces Warnings/FileNotFoundExceptions for
    • Microsoft.CodeAnalysis.NetAnalyzers, Version=5.0.4.22903
    • Microsoft.CodeAnalysis.Workspaces, Version=3.3.0.0

My solution structure looks like the following:

\Solution.sln
\src
    \ProjectA
    \ProjectB
\test
    \ProjectA.Tests
    \ProejctB.Tests

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pinkfloydx33commented, Apr 21, 2022

Haven’t seen it happen; I’m on Stryker 1.x now and .NET 6 on that specific project which I’m sure makes some sort of difference

0reactions
dupdobcommented, Apr 21, 2022

@pinkfloydx33 : if you still have this problem, can you please try again with the latest release? Several bug fixes have been implemented and the situation should have improved

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Asked Questions | Stryker Mutator
No coverage means that the original, unmodified code did not have test coverage, As such, every mutant would survive and is as such...
Read more >
Mutation testing: first steps with Stryker-Mutator .Net
No test coverage. That is, mutants that survived simply because the code was not part of any test whatsoever. It should not have...
Read more >
stryker-mutator/core/README.md
When Stryker is mutating code, it cannot determine indefinitely whether a code mutation results in an infinite loop (see [Halting problem](https://en.wikipedia.
Read more >
Mutation Testing with Stryker (with Adrianne Mallett)
Like, it's not an all-or-nothing thing. Another thing to call out is it just depends on your use case. Your team may not...
Read more >
An intro to Mutation Testing - or why coverage sucks
This test covers all the cases and reports 100% coverage, ... On the mutation testing subject, not all mutations are interesting, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found