-
Notifications
You must be signed in to change notification settings - Fork 14
Getting started
The main entry point for MuTalk is the mutation testing analysis class MTAnalysis
. This is the object that you will most of the time interact with in order to perform mutation testing on your project.
To apply mutation testing on your code, you first need to configure the analysis. So let's create it:
analysis := MTAnalysis new.
Then you need to specify the source code you want to mutate. To do so, you can give the analysis a collection of classes or a collection of packages:
analysis classesToMutate: { MyClass1 . MyClass2 }.
or
analysis packagesToMutate: { MyPackage1 . MyPackage2 }.
Finally you should give the analysis the tests that come with the classes you mutate. They should all be green, because if some are already red the analysis won't be able to tell if a mutant is killed or not. Just like above, you can either give classes or packages:
analysis testClasses: { MyTestClass1 . MyTestClass2 }.
or
analysis testPackages: { MyTestPackage1 . MyTestPackage2 }.
You could run the analysis now if you wanted, because all the other parameters are set with default values:
- mutant generation strategy: MTAllMutantGenerationStrategy
- mutant selection strategy: MTRandomOperatorMutantSelectionStrategy
- test selection strategy: MTSelectingFromCoverageTestSelectionStrategy
- budget: MTTimeBudget
- test filter: MTCompositeTestFilter with MTRedTestFilter and MTTimeTestFilter set to not take into account the top 10% most long to run tests
- logger: MTProgressBarLogger
- operators: all of them
You can now run the analysis and inspect the results:
analysis run.
analysis generalResult inspect
To know more on how to configure the analysis, go check the other pages of this wiki.