Urgent <> Unable to get any mutation score and stryker is skipping all run - Stryker dot net #2977
Replies: 22 comments 47 replies
-
You're supplying the option -m without argument, so nothing is mutation tested. |
Beta Was this translation helpful? Give feedback.
-
Now I am getting this No branch or tag or commit found with given target refs/heads/develop. Please |
Beta Was this translation helpful? Give feedback.
-
Your pipeline is probably doing shallow fetch so does not include all refs and this Stryker cannot find the ref you specified |
Beta Was this translation helpful? Give feedback.
-
@rouke-broersma There is no mutation ran ever on develop and there is no report stored anywhere. Is it important to store the baseline somewhere? Can I store it in the repo itself? Can you please explain me in steps what exactly should i do and how can I run mutation tests only for the changes i have done in my feature branch instead of whole develop branch? So that i can test the newly changes not the old source codes. |
Beta Was this translation helpful? Give feedback.
-
If you don't care about storing the report, use the since feature not the baseline feature |
Beta Was this translation helpful? Give feedback.
-
So I just need to pass feature branch name or the develop branch name? |
Beta Was this translation helpful? Give feedback.
-
@rouke-broersma
|
Beta Was this translation helpful? Give feedback.
-
@inishantmishra : CI pipeline works on a light copy of the git repository (via this option https://git-scm.com/docs/git-fetch#Documentation/git-fetch.txt---depthltdepthgt). Which makes sense from a CI pipeline which only builds the software, but if git history is missing, Stryker is not able to identify the reference point. And no way to identify which parts of the code have been changed. Stryker can't do anything about that You need to look on how to fetch a full git history (or a deep enough one) on your pipeline. Is it clearer? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Regarding ignored mutations: Stryker automatically ignores block mutations (replacing a block with an empty block) when there are mutations in the block; the assumption is that there would be no situation where mutations inside the block are killed while the block mutation survives. This implies these mutations have little marginal value so Stryker skips them to save on test time. |
Beta Was this translation helpful? Give feedback.
-
Stryker takes more than 9 minutes to run the mutation. And I think once the repo or test cases will increase it will take more. How can we reduce the time? How can we make it fast? How does it run by default? |
Beta Was this translation helpful? Give feedback.
-
9 minutes is quite fast actually. Mutation testing is slow by essence. The best approach is to look on how to make tests faster. Alternatively, you can restrict which mutators are active and reduce the # of mutations, but it has obvious downsides |
Beta Was this translation helpful? Give feedback.
-
Any way to make it faster? Cant we do some byte code change not the actual code change in the mutation process to make it faster? |
Beta Was this translation helpful? Give feedback.
-
And how to filter out time taking tests like integration tests from running mutations on it? |
Beta Was this translation helpful? Give feedback.
-
Byte code change would not make this any faster. We place all mutants at once. Mutation testing takes a lot of time because we have to run your unit tests multiple times, that's inherent to mutation testing. This would not be different for byte code mutations. |
Beta Was this translation helpful? Give feedback.
-
Sure, use test filters like you normally would. Stryker supports this. |
Beta Was this translation helpful? Give feedback.
-
@rouke-broersma Any reference, how to use test filters? |
Beta Was this translation helpful? Give feedback.
-
https://stryker-mutator.io/docs/stryker-net/configuration/#test-case-filter-string |
Beta Was this translation helpful? Give feedback.
-
Can you guys please help me in understanding how to use baseline report for comparison during PR build check. Lets say I have a baseline report stored in develop branch of repo. And how will it the baseline report of develop branch will get updated lets say if featre branch is merged with develop and also think of some scenarios if feature branch is not merged and PR is cancelled. How exactly the baseline feature works? |
Beta Was this translation helpful? Give feedback.
-
You guys said this- But my striker when runs mutates the code which was in develop branch since beginning and is not changed in feature branch. And it is referring some of survived mutants from those methods.. How to ignore those methods. I cant go ahead specify manually to ignore those old methods. Why doesn't since automatically ignores the methods of develop branch and only runs on feature branch and that too on methods which is being added new or modified? What should I do? |
Beta Was this translation helpful? Give feedback.
-
Hi @dupdob @rouke-broersma I have create a baseline report in HTML as well in json format with name mutation-report.json and placed it over secured azure blob storage. Now, I want to run mutation as Build Validation when someone raises the Pull request and it should run between the source branch of Pull Request and the baseline report which i had generated earlier. So, what i do is that i have pipeline in azure devops which first creates a directory in in the agent at -> $(Agent.BuildDirectory) where the code is checked out and mutation is going to run. Director created will be -> StrykerReports/Baselines and here we will download the baseline report from blob storage and will place over here. And now, post download we run mutation testing via the following command- But i am keep on getting the error that unknown command. Followign is the error Unrecognized command or argument 'D:\a\1\StrykerReports\Baselines\mutation-report.json' Please help what should I do, i switched from since to baseline but again facing the issue. |
Beta Was this translation helpful? Give feedback.
-
@rouke-broersma @dupdob I went through the entire discussion and I am working on something very similar where I want to make the threshold dynamic in a way that every time a new mutation score comes up for my develop branch the old score gets updated and the new one becomes the new threshold value. I am able to run baseline with develop and generate a mutation score but I am very skeptical about the possibility of how to update the new threshold. Can you please guide me a way out through this. Would be of great help. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi I am running following script to run in my pipeline-
dotnet-stryker --test-project "**/*Test.csproj" -m --with-baseline:$(System.PullRequest.TargetBranch) --version $(System.PullRequest.SourceBranch) --open-report --reporter "html" --reporter "progress" --reporter "cleartext" --break-at 80
But I am not getting the score and not getting any result. It seems all mutants are ignore but i haven't added any exclusion logic neither in comments nor in command.
Here are some snippet from logs
[17:30:58 WRN] Failed to load analyzer 'Microsoft.Extensions.Logging.Generators': Exception System.IO.FileLoadException: Assembly with same name is already loaded
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.AnalyzerAssemblyLoader.LoadFromPath(String fullPath) in //src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultExtensions.cs:line 126
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetAssembly()
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions1.AddExtensions(Builder builder, String language, Func2 shouldInclude).
[17:30:58 WRN] Failed to load analyzer 'Microsoft.Extensions.Options.SourceGeneration': Assembly with same name is already loaded (error : UnableToLoadAnalyzer, analyzer: All).
[17:30:58 WRN] Failed to load analyzer 'Microsoft.Extensions.Options.SourceGeneration': Exception System.IO.FileLoadException: Assembly with same name is already loaded
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Stryker.Core.Initialisation.Buildalyzer.IAnalyzerResultExtensions.AnalyzerAssemblyLoader.LoadFromPath(String fullPath) in //src/Stryker.Core/Stryker.Core/Initialisation/Buildalyzer/IAnalyzerResultExtensions.cs:line 126
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.GetAssembly()
at Microsoft.CodeAnalysis.Diagnostics.AnalyzerFileReference.Extensions1.AddExtensions(Builder builder, String language, Func2 shouldInclude).
[17:31:34 INF] 6417 mutants created
[17:31:34 INF] Capture mutant coverage using 'CoverageBasedTest' mode.
[17:34:36 INF] 160 mutants got status CompileError. Reason: Mutant caused compile errors
[17:34:36 INF] 596 mutants got status Ignored. Reason: Removed by exclude from code coverage filter
[17:34:36 INF] 5661 mutants got status Ignored. Reason: Removed by mutate filter
[17:34:36 INF] 6417 total mutants are skipped for the above mentioned reasons
[17:34:36 INF] 0 total mutants will be tested
[17:34:36 WRN] It looks like all mutants with tests were ignored. Try a re-run with less ignoring!
[17:34:36 WRN] It looks like all mutants resulted in compile errors. Mutants sure are strange!
Killed: 0
Survived: 0
Timeout: 0
All mutants have been tested, and your mutation score has been calculated
Please help and let me know what is happening or is there anything wrong am i doing?
Beta Was this translation helpful? Give feedback.
All reactions