Stryker.NET support for SLN files from the root of the project

685 views Asked by At

Getting different mutation scores each time I run Stryker from the root of the project which has multiple test projects.

Does stryker support running '.sln' files from the root of the project?

Command used from the root of the project: dotnet stryker --solution-path "Project.sln"

Env: Linux, Windows, .NET core

Any insight is appreciated. Thank you.

2

There are 2 answers

0
psfinaki On

Solution mode isn't working properly yet thus it's not really documented. You can use this script for now - a little raw but works.

0
Ben Wesson On

I have faced the same issue previously and conceded defeat. The path of least resistance for me in terms of unit test code coverage and also stryker mutation testing is to have all unit tests in a single project and execute stryker from the folder where the test.csproj is location. My build pipeline script (running in GitLab on Linux) looks something like this:

    - dotnet build
    - cp ./resources/stryker/stryker-config.json ./*.Tests
    - cd ./*.Tests
    - dotnet stryker

It first builds the whole solution, then copies a known config file into the test project folder, then change directory into that folder and execute stryker.