Skip to content

MTMatrix

DurieuxPol edited this page Oct 18, 2024 · 11 revisions

A MTMatrix represents the results of some mutations against some tests. A blue box means the test fails for the mutation.
image

How to use

There are 4 ways to create a MTMatrix depending on the situation:

  • using a collection of classes (when the test classes simply have the suffixe "Test"):
    • matrix := MTMatrix forClasses: { MTAuxiliarClassForMatrix }
  • using collections of classes and tests:
    • matrix := MTMatrix forClasses: { UUID } andTests: { UUIDTest. UUIDPrimitivesTest }
  • using a collection of packages (when the test packages simply have the suffixe "-Tests"):
    • matrix := MTMatrix forAPackage: { 'Athens-Core' }
  • using collections of packages and test packages:
    • matrix := MTMatrix forAPackage: { 'Network-UUID' } andTestPackage: { 'Network-Tests' }

Features

Now that you have your matrix, you can get several information about the mutations of your subject with it.
But before that you need to build it with:

  • matrix build

Visualisation

You can generate a matrix like the one above:

matrix generateMatrix

You can also generate a heat map, where mutants are grouped by operator and tests by classes:

matrix generateHeatmap

These are the information you can get:

Trivial mutants

Mutants killed by every tests:

matrix trivialMutants inspect

Equivalent mutants

Mutants that are killed by the exact same tests.
equivalentMutants returns all sets of mutants mutually equivalent:

matrix equivalentMutants inspect

Included mutants

For a given mutant, all mutants that are killed by the same tests as the given mutant or part of those tests, and no others.
includedMutants returns a dictionary of all mutants and their included mutants:

matrix includedMutants inspect