Closed raschmitt closed 4 years ago
It is not standard to use one test project for multiple source projects, and so we haven't designed Stryker to work in this way. Multiple configurations is the way to go if you insist on this configuration. Or, you can simply split out your tests in separate projects.
Does that answer your question?
@Mobrockers yes it does, thanks.
For anyone reading this in the future, I ended up automatizing my run strategy with the following command in a .bat
file:
for %%p in (api, domain, infra) do dotnet stryker -cp stryker-config-%%p.json
@raschmitt There is another way actually. You would still have to move your projects but wont have to split your test project.
We have the possibility to run from the project under test location as well as running from the test project location. If you move your Api, Domain and Infra projects into seperate folders (like the standard for .net) you can run from each folder without multiple config files.
So your project structure should look like:
src
-- Api
---- Api.csproj
-- Domain
---- Domain.csproj
-- Infra
---- Infra.csproj
-- Tests
---- Tests.csproj
You do have to pass the test project location if you do that. It looks like:
dotnet stryker --test-projects "['../MyProject.UnitTests/MyProject.UnitTests.csproj']"
*note that splitting your test project is the better way to solve this.
Right, I forgot about that feature! @raschmitt
I'm currently using stryker to run mutations against a test project that references multiple projects:
What I'm currently doing is creating multiple configuration files and running mutations for each config separately.
stryker-config-api.json
stryker-config-domain.json
stryker-config-infra.json
Is this the way to go? Or there is a better approach?