public class TestSuiteLocalSearchObjective extends Object implements LocalSearchObjective<TestChromosome>
TestSuiteLocalSearchObjective has an internal reference to the whole test suite
and an index to the position of the test case that is being modified by means of local search.| Modifier and Type | Method and Description |
|---|---|
void |
addFitnessFunction(FitnessFunction<? extends Chromosome> fitness)
Since the fitness is governed by the underlying suite associated to this
goal, this function should never be invoked.
|
static TestSuiteLocalSearchObjective |
buildNewTestSuiteLocalSearchObjective(List<FitnessFunction<? extends Chromosome>> fitness,
TestSuiteChromosome suite,
int index)
Creates a new
TestSuiteLocalSearchObjective for a given list
of fitness functions, a test suite and a testIndex for
replacing an optimised test case (i.e. |
List<FitnessFunction<? extends Chromosome>> |
getFitnessFunctions()
Since the fitness is computed by the underlying test suite associated to
this local search objective, this function should not belong.
|
int |
hasChanged(TestChromosome testCase)
Overrides the test case at position
testIndex with the
individual. |
boolean |
hasImproved(TestChromosome testCase)
Replaces the test case at position
testIndex with the passed
TestChromosome. |
boolean |
hasNotWorsened(TestChromosome testCase)
Returns true if by replacing the test case at position
testIndex with the argument testCase, the
resulting test suite has not worsened the fitness |
boolean |
isDone()
Returns true if all the fitness functions are minimising and the fitness
value for each of them is 0.0
|
boolean |
isMaximizationObjective()
Returns true if all the fitness functions are maximising functions
(Observe that it is not possible to store simoustaneously maximising and
minimising fitness functions)
|
public static TestSuiteLocalSearchObjective buildNewTestSuiteLocalSearchObjective(List<FitnessFunction<? extends Chromosome>> fitness, TestSuiteChromosome suite, int index)
TestSuiteLocalSearchObjective for a given list
of fitness functions, a test suite and a testIndex for
replacing an optimised test case (i.e. a test case over which was applied
local search)fitness - the list of fitness functions to be used on the modified test
suitesuite - the original test suiteindex - the index (between 0 and the suite length) that will be
replaced with a new test casepublic boolean isDone()
isDone in interface LocalSearchObjective<TestChromosome>public boolean hasImproved(TestChromosome testCase)
testIndex with the passed
TestChromosome.hasImproved in interface LocalSearchObjective<TestChromosome>testCase - a Chromosome object.public boolean hasNotWorsened(TestChromosome testCase)
testIndex with the argument testCase, the
resulting test suite has not worsened the fitnesshasNotWorsened in interface LocalSearchObjective<TestChromosome>testCase - a Chromosome object.public int hasChanged(TestChromosome testCase)
testIndex with the
individual. It returns -1 if the new fitness has improved,
1 if the fitness has worsened or 0 if the
fitness has not changed.hasChanged in interface LocalSearchObjective<TestChromosome>testCase - a Chromosome object.public List<FitnessFunction<? extends Chromosome>> getFitnessFunctions()
getFitnessFunctions in interface LocalSearchObjective<TestChromosome>FitnessFunction object.public void addFitnessFunction(FitnessFunction<? extends Chromosome> fitness)
addFitnessFunction in interface LocalSearchObjective<TestChromosome>public boolean isMaximizationObjective()
LocalSearchObjectiveisMaximizationObjective in interface LocalSearchObjective<TestChromosome>Copyright © 2010–2017 EvoSuite. All rights reserved.