Skip to content

Getting started

DurieuxPol edited this page Apr 12, 2024 · 10 revisions

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.

The analysis

To apply mutation testing on your code, you first need to configure the analysis. So let's create it:

analysis := MTAnalysis new.

What to mutate

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 }.

Tests

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 }.

Default values

You could run the analysis now if you wanted, because all the other parameters are set with default values:

Run and results

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.