stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.75k stars 176 forks source link

Support Microsoft Fakes shims #1302

Open djyuran opened 3 years ago

djyuran commented 3 years ago

Version: 0.17.1 (beta)

A new version of Stryker.NET (0.20.0) is available. Please consider upgrading using dotnet tool update -g dotnet-stryker

[20:47:12 INF] Identifying project to mutate. [20:47:21 INF] The project [removed].Worker.csproj will be mutated. [20:47:26 INF] Restoring nuget packages using nuget.exe [20:47:35 INF] Analysis complete. [20:47:35 INF] Building test project [removed].UnitTests.csproj (1/1) [20:47:52 INF] Initializing test runners (VsTest) [20:48:00 INF] Test runners are ready [20:48:00 INF] Total number of tests found: 2 [20:48:00 INF] Initial testrun started [20:48:33 WRN] Initial test run failed. Mutation score cannot be computed. [20:48:33 INF] Time Elapsed 00:01:22.3910662 Stryker.NET failed to mutate your project. For more information see the logs below:

Initial testrun was not successful.

Test method [removed].AppContainerTests.AppContainer_TestLifecycle threw exception: Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to resolve profiler path from COR_PROFILER_PATH and COR_PROFILER environment variables.

rouke-broersma commented 3 years ago

Hi @djyuran We do not use microsoft Fakes so I cannot confirm or deny if it's supposed to work. We've never tried it. Are COR_PROFILER_PATH and COR_PROFILER some specific environment variables that need to be available in the test process?

dupdob commented 3 years ago

I just did a cursory search and it may be related to this: https://stackoverflow.com/questions/41341129/failed-to-resolve-profiler-path-from-cor-profiler-path-and-cor-profiler-environm

Also, it looks like 'OpenCover' find some workaround for this issue: https://github.com/OpenCover/opencover/blob/df7728194c378a5fa06bce4b02c1c321b0b65432/main/OpenCover.Support/Fakes/FakesHelper.cs

rouke-broersma commented 3 years ago

We probably need to implement the same workaround then, since we are using vstest directly and not going through visual studio so even if the user has enterprise edition we would not be using those capabilities.

djyuran commented 3 years ago

Thanks guys for a quick turnaround! Unfortunately most of the projects in my team use Fakes so I can't onboard Stryker.NET so far but I really want to do that as an excellent tool to check unit test quality.

Just wondering when does enhancement like that usually get implemented? Or it is a open source project and if I need something I should do that?

rouke-broersma commented 3 years ago

Thanks guys for a quick turnaround! Unfortunately most of the projects in my team use Fakes so I can't onboard Stryker.NET so far but I really want to do that as an excellent tool to check unit test quality.

Just wondering when does enhancement like that usually get implemented? Or it is a open source project and if I need something I should do that?

It is an open source project, and if you can provide time to add something you want we would really appreciate the contribution ;) If you don't have time to do it yourself then it will depend on when one of us or another contributor can find the time to add this feature. We do this in our own time as well, so there's no guarantees.