Ignore log entries in Stryker mutation test

899 views Asked by At

I'm adding Stryker.net to my C# project. I see that it mutates on all log entries. Is there any way I can ignore these in the config?

2

There are 2 answers

4
psfinaki On BEST ANSWER

Depends on how your logging looks like, but most probably you can play with the ignore-methods option.

For example, dotnet stryker -im "['Logger.Log']" or even just dotnet stryker -im "['*Log']"

1
Rares-Mihai Chelariu On

The following is a valid solution, when for logging you are using the interface Microsoft.Extensions.Logging.ILogger<>.

Create a file named stryker-config.json in the root of your tests project. Populate it with the following:

{
  "stryker-config": {
    "ignore-methods": [
      "*LogCrititcal*",
      "*LogDebug*",
      "*LogError*",
      "*LogInformation*",
      "*LogTrace*",
      "*LogWarning*"
    ]
  }
}

This configuration will ignore the methods of the interface.