-
Notifications
You must be signed in to change notification settings - Fork 14
Mutant selection strategies
Mutant selection strategies, as mentionned here, are used to shuffle the mutant collection from the generation strategy before returning it to the analysis.
There are 5 mutant selection strategies:
- MTRandomOperatorMutantSelectionStrategy
- MTMutantSelectionStrategy
- MTRandomMutantSelectionStrategy
- MTRandomClassMutantSelectionStrategy
- MTRandomMethodMutantSelectionStrategy
This is the default mutant selection strategy used by the analysis.
This strategy shuffles the mutant collection in two steps:
- it first randomly selects a mutation operator among the operators of the mutants (it means that if no mutant of the collection comes from the operator "OperatorA", this operator can't be selected)
- then it selects randomly a mutant among the mutants from this operator
This selection ensures that all operators have their mutants represented the most equally possible, and avoids that operators that produce a small amount of mutants are under-represented in the results.
To use this selection strategy:
analysis mutantGenerationStrategy mutantSelectionStrategy: MTRandomOperatorMutantSelectionStrategy new
or directly when creating the generation strategy:
analysis mutantGenerationStrategy: MTAllMutantGenerationStrategy withRandomOperatorMutantSelection
This is the default mutant selection strategy used by mutant generation strategies when created, but not the default one used by the analysis.
This is the basic selection strategy. It doesn't shuffle the mutant collection, just returns it as it is.
To use it for your generation strategy:
analysis mutantGenerationStrategy mutantSelectionStrategy: MTMutantSelectionStrategy new
This strategy shuffles completely randomly the mutant collection. This strategy, as well as the others random mutant selection strategies, are especially relevant to use when paired with budgets, because all mutants won't probably be evaluated. So when running the analysis multiple times, the evaluated mutants won't always be the same.
To use this selection strategy:
analysis mutantGenerationStrategy mutantSelectionStrategy: MTRandomMutantSelectionStrategy new
or directly when creating the generation strategy:
analysis mutantGenerationStrategy: MTAllMutantGenerationStrategy withRandomMutantSelection
Like the random operator mutant selection strategy this one works exactly the same, but with classes rather than operators.
To use this selection strategy:
analysis mutantGenerationStrategy mutantSelectionStrategy: MTRandomClassMutantSelectionStrategy new
or directly when creating the generation strategy:
analysis mutantGenerationStrategy: MTAllMutantGenerationStrategy withRandomClassMutantSelection
Again this strategy follows the same pattern, but here with methods.
To use this selection strategy:
analysis mutantGenerationStrategy mutantSelectionStrategy: MTRandomMethodMutantSelectionStrategy new
or directly when creating the generation strategy:
analysis mutantGenerationStrategy: MTAllMutantGenerationStrategy withRandomMethodMutantSelection