-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stryker.NET doesn't handle xUnit v3 properly #3117
Comments
We have quite some custom logic for dealing with specific test framework quirks, I suspect xunit v3 has added yet another layer of quirks. |
I predict a big one: it looks like a lot of VsTest design rules are violated here. |
First AnalysisStryker is not able to run xUnit 3 theories with inline data, that is Stryker detects them correctly but they are skipped by the runner The good news is that it does not look like a big issue. |
Update
Conclusion at this stageIt is likely that the xUnit V3 test runner executes the tests outside the VsTest host. But, Stryker requires its VsTest extension to run inside the test process. |
Consequences
I do not think trying to fit support for xUnitV3 via VsTest is worth the effort, I suppose the move to mstest will provide a smoother solution. But that remains to be confirmed. The alternative is to implement a dedicated runner for xUnit V3, which would provide other interesting benefits but looks like a lot of work. |
For context: After reading, I think the best approach would be to have a xUnit dedicated test runner... |
Why have standards.. 🫠 |
I just opened a PR that re enables basic support for xUnit V3, via disabling coverage based optimization when capture appears to have failed and the use of environment variables for mutation control. Of course, it will result in a slow execution. Sill, it is a possible way forward. |
PR #3122 restore basic support for xUnit V3. Basic as no coverage based optimization possible. |
Let's ping @bradwilson on this issue. He's been very helpful when I reported issues on the early xUnit v3 prereleases. Maybe he can give some guidance. |
This is controlled by configuration and/or RunSettings. The default for whether we pre-enumerate theories depends on the runner in question: we generally disable it with our console runner, and enable it with If you are invoking a v3 test assembly in automated mode, then
That is correct. v3 test projects are executables. When running v3 tests with
Ask away. 😄 |
Thanks @bradwilson. Can we toggle the 'in-proc' run flag via some visualstudio runner's custom settings? Stryker currently relies on an inproc VsTest data collector to track mutation coverage and with xunit v3 running out of process, it reports no coverage; this new architecture makes. 'in proc' data collector useless in general. Regarding the enumeration of theories during tests discovery, this is a secondary issue. But I tried modified the settings to no avail: theories in the sample projects are not pre enumerated; these are inline data theories, if this makes any difference . For context, Stryker always enables design mode, and we had no problem with the latest xUnit V2.xx. |
No, that ability is only provided to runner authors. You'd need a replacement for xunit.runner.visualstudio that could run things in-process, and you'd be entirely responsible for the dependency resolution. In practice, this isn't something that's easy to do; I personally have tried and failed, so I wouldn't be able to help you do it. Part of the reason that this is a challenging task is that it also involves any unmanaged dependency resolution, assuming you have customers who are using unmanaged dependencies (like C++ libraries).
This isn't just the architecture of xUnit.net v3; it's also the architecture of Microsoft.Testing.Platform. That means MSTest 3.6+ tests which enable MTP will be in the same situation that you find yourself with xUnit.net v3 today.
There may be a bug here, then. When design mode is enabled, pre-enumeration should be on (unless explicitly turned off via config). |
@bradwilson we use the vstest translation layer /test platform v2 so currently our design is not compatible with mstest testplatform anyway. I think this requires xunit.runner.visualstudio as well, so in that case shouldn't the data collector be running on proc already like we require? Nevermind I mixed up the two different settings. |
Describe the bug
When using xUnit v3, Stryker.NET produces warnings and can't perform proper mutations.
Reproduction steps
Checkout the xunit-v3 branch of the Serilog.Formatting.Log4Net project and run
dotnet tool restore && dotnet stryker
at the root of the repository.Expected behavior
Stryker.NET performs mutations and gives the same score (100%) as when using xUnit v2.
Dashboard with xUnit v2 (on the
main
branch): 100%Actual behaviour
Stryker.NET produces many warnings and eventually fails to perform the mutations.
Dashboard with xUnit v3: 3.09%
Desktop
Additional context
I have not enabled Microsoft Testing Platform support in xUnit.net v3 so I don't think this is related to #3094 although I'm not totally sure.
The text was updated successfully, but these errors were encountered: