stryker-mutator / stryker-net

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

Allow multiple configuration files #2640

Closed patwalb closed 12 months ago

patwalb commented 1 year ago

Configuring solutions with many projects

I use Stryker .NET for larger solutions. Currently, I am integrating version 3.10 in a solution that contains about 20 source and 20 unittest projects. So frankly speaking, I would need 20 stryker-config.json files to configure this solution-wide. One for each testProject(e.g. for excluding files, setting threshold). That requires a lot of maintaining etc. Currently, I trigger all 20 stryker runs from a shell script (The dashboard/solution mode is no alternative for me). That works quite fine, just the configuration is a bit an obstacle

I think it would be really adventagous to allow one solutionwide stryker-config.json that defines e.g. threshold levels, mutation-level etc. for all projects within a solution. Additionally, there would be also one project-based stryker-config.json (optional) for each project. It would add or override additional attributes, such as excluded files. Currently, it is just possible to read-in one config file.

If I want like to change the thresholds I need to change it currently in twenty project-basedstryker-config.json files.

I could imagine to call the new configuration like this dotnet stryker --project <projectA> --config-file solution-stryker-config.json --config-file <projectA>/stryker-config.json (second config file is higher prior)

Alternative

Also an option would be to configure the global/solutionwide settings in my script by calling dotnet stryker --<solutionWideConfig1> ... --<solutionWideConfigN> and would add addtional/projectspecific config in the stryker-config.json based in the project. Nevertheless, the commandLineArguments are higher prior then the one of the config file and for some reasons for certain option no command line configuration exists, e.g. Thresholds.

Also an option is to have an "own" solution-stryker-config.json and merge it via script (e.g. Python) in each of the project-based stryker-configs.json files. This is the alternative I consider.

I think I am quite familiar now with Stryker, but maybe it overlooked an option how you do it. Interested to hear feedback :) 👍

rouke-broersma commented 1 year ago

Iirc we already have an open issue for this feature request. It is something we want to support when we have the bandwidth to properly design and implement this.

tomdaniel-mensura commented 9 months ago

@rouke-broersma Can you please link the already open issue to this one, so that this discussion isn't a dead end? (aka just referencing it in a comment)

rouke-broersma commented 9 months ago

2323