Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore log entries in Stryker mutation test

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?

like image 848
runnerpaul Avatar asked Oct 20 '25 16:10

runnerpaul


2 Answers

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']"

like image 88
psfinaki Avatar answered Oct 23 '25 04:10

psfinaki


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.

like image 30
Rares-Mihai Chelariu Avatar answered Oct 23 '25 04:10

Rares-Mihai Chelariu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!