public class MutationModel
extends java.lang.Object
This class reads, combines and generates FirstOrderMutant
s and
HigherOrderMutant
s
Constructor and Description |
---|
MutationModel() |
Modifier and Type | Method and Description |
---|---|
static Population<HigherOrderMutant> |
generateRandomPopulation(java.lang.String originalFile,
java.lang.String testCasesPath,
java.util.Set<MessageListener> messageListeners) |
static FirstOrderMutant |
getRandomMutant(HigherOrderMutant mutant)
Returns a random
FirstOrderMutant that can be applied to the provided
HigherOrderMutant |
static java.lang.String |
init(java.lang.String originalFile,
java.lang.String mutantsPath,
java.lang.String testCasesPath,
java.util.Set<MessageListener> messageListeners)
Initializes the model by filling
first_order_mutants
and setting originalCode |
public static java.lang.String init(java.lang.String originalFile, java.lang.String mutantsPath, java.lang.String testCasesPath, java.util.Set<MessageListener> messageListeners) throws java.lang.Exception
Initializes the model by filling first_order_mutants
and setting originalCode
After reading the first_order_mutants
this class
executes these mutants using TestExecutor#execute(List, Config, Set)
originalFile
- to be mutatedmutantsPath
- to store the mutants intestCasesPath
- path to test casesmessageListeners
- for loggingjava.lang.Exception
- if anything goes downpublic static Population<HigherOrderMutant> generateRandomPopulation(java.lang.String originalFile, java.lang.String testCasesPath, java.util.Set<MessageListener> messageListeners)
originalFile
- to use in choosing mutantstestCasesPath
- path to test casesmessageListeners
- to logSpecifications
public static final FirstOrderMutant getRandomMutant(HigherOrderMutant mutant)
Returns a random FirstOrderMutant
that can be applied to the provided
HigherOrderMutant
The returned FirstOrderMutant
should be valid to be added to the
HigherOrderMutant
The validation is done by the following criterion:
The FirstOrderMutant
s of a HigherOrderMutant
should have
unique mutated lines.
example:
original code:
int z = x + y;
return z;
Mutant #1
int z = x - y;
return z;
Mutant #2
int z = x * y;
return z;
Mutant #3
int z = x + y;
return --z;
Mutants [1 and 2] can not be added to the same HigherOrderMutant
because they have same mutated line index
Mutants [1 and 3] or [2 and 3] can be added to the same
HigherOrderMutant
mutant
- for validationFirstOrderMutant