For C#
  • Introduction
  • Quickstart
  • Quickstart

    Install Stryker using NuGet.

    1 Install

    To install Stryker.NET on your test project add the following lines to the root of your .csproj file. on your test project.

    <ItemGroup>
        <DotNetCliToolReference Include="StrykerMutator.DotNetCoreCli" Version="*" />
        <PackageReference Include="StrykerMutator.DotNetCoreCli" Version="*" />
    </ItemGroup>
    

    After adding the references, install the packages by executing dotnet restore inside the project folder.

    dotnet restore 
    

    2 Let's kill some mutants

    Run Stryker.NET to mutation test your project

     dotnet stryker

    3 Configure

    Stryker will always look for a stryker-config.json file in the root of the test project. When found it will use the parameters in the file.

    {
        "stryker-config":
        {
            "reporter":"Console",
            "logConsole":"info",
            "timeoutMS":10000,
            "logFile":true,
            "projectName":"ExampleProject.csproj"
        }
    }
    

    All the arguments in the configuration are optional.

    Note

    In some cases Stryker cannot run without the projectName argument. Specify the name of the referenced project that should be mutated here. Stryker can only mutate one project in a single run. When it finds more references it will use the name in projectName to find the one project to mutate.

    For more information on what these options mean, take a look at the Stryker.NET readme

    Console

    All arguments can also be passed through the console.

    dotnet stryker --logConsole debug
    

    Arguments both assigned in the config file and the console will use the value assigned in the console.

    Need help?