public class MethodCoverageSuiteFitness extends TestSuiteFitnessFunction
| Modifier and Type | Field and Description |
|---|---|
protected double |
bestFitness |
protected int |
maxCoveredMethods |
protected Map<String,TestFitnessFunction> |
methodCoverageMap |
protected Set<String> |
methods |
protected Set<String> |
removedMethods |
protected Set<String> |
toRemoveMethods |
protected int |
totalMethods |
| Constructor and Description |
|---|
MethodCoverageSuiteFitness()
Constructor for MethodCoverageSuiteFitness.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
analyzeTraces(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite,
List<ExecutionResult> results,
Set<String> calledMethods)
Iterate over all execution results and summarize statistics
|
protected static <T extends Comparable<? super T>> |
asSortedList(Collection<T> c) |
protected void |
determineCoverageGoals()
Initialize the set of known coverage goals
|
protected void |
determineMethods() |
protected void |
determineMethods(Class<?> clazz,
String className) |
double |
getFitness(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite)
Calculate and set fitness function #TODO the 'set fitness' part should be
done by some abstract super class of all FitnessFunctions
|
protected void |
handleConstructorExceptions(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite,
List<ExecutionResult> results,
Set<String> calledMethods)
If there is an exception in a super-constructor, then the corresponding
constructor might not be included in the execution trace
|
protected boolean |
isValidPosition(ExecutionResult result,
Integer position) |
protected void |
printStatusMessages(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite,
int coveredMethods,
double fitness)
Some useful debug information
|
boolean |
updateCoveredGoals()
if the fitness function contains an archive, updates the archive and the fitness values of the population, and returns true.
|
isMaximizationFunction, runTest, runTestSuitegetBestStoredIndividual, normalize, updateIndividual, updateIndividualprotected final int totalMethods
protected int maxCoveredMethods
protected double bestFitness
protected final Map<String,TestFitnessFunction> methodCoverageMap
public MethodCoverageSuiteFitness()
Constructor for MethodCoverageSuiteFitness.
protected void determineMethods()
protected void determineCoverageGoals()
protected void handleConstructorExceptions(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite, List<ExecutionResult> results, Set<String> calledMethods)
results - calledMethods - protected boolean analyzeTraces(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite, List<ExecutionResult> results, Set<String> calledMethods)
results - calledMethods - protected boolean isValidPosition(ExecutionResult result, Integer position)
protected static <T extends Comparable<? super T>> List<T> asSortedList(Collection<T> c)
public double getFitness(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite)
getFitness in class FitnessFunction<AbstractTestSuiteChromosome<? extends ExecutableChromosome>>suite - a Chromosome object.protected void printStatusMessages(AbstractTestSuiteChromosome<? extends ExecutableChromosome> suite, int coveredMethods, double fitness)
coveredMethods - fitness - public boolean updateCoveredGoals()
FitnessFunctionupdateCoveredGoals in class FitnessFunction<AbstractTestSuiteChromosome<? extends ExecutableChromosome>>Copyright © 2010–2017 EvoSuite. All rights reserved.