Class SuspiciousCombinationAlgorithm
- java.lang.Object
-
- de.rwth.swc.coffee4j.algorithmic.sequential.characterization.SuspiciousCombinationAlgorithm
-
- All Implemented Interfaces:
FaultCharacterizationAlgorithm
- Direct Known Subclasses:
Ben
public abstract class SuspiciousCombinationAlgorithm extends Object implements FaultCharacterizationAlgorithm
A "helper" class for some fault characterization algorithms. It has been observed that many algorithms like AIFL and BEN work by keeping an internal list of suspicious combinations. They then generate new test inputs if a criterion is met and those test inputs are used to refine the suspicious set by removing all suspicious combinations appearing in a successful test. The basic housekeeping work is done by this class so the algorithms can focus on the important bits.The class keeps two sets of suspicious combinations in memory: the current one, and one from last iteration. This is needed to calculate differences. Additionally, the
FaultCharacterizationConfiguration
and all test results are stored.
-
-
Field Summary
Fields Modifier and Type Field Description protected FaultCharacterizationConfiguration
configuration
protected Set<IntArrayWrapper>
previousSuspiciousCombinations
protected Set<IntArrayWrapper>
suspiciousCombinations
protected Map<IntArrayWrapper,TestResult>
testResults
-
Constructor Summary
Constructors Modifier Constructor Description protected
SuspiciousCombinationAlgorithm(FaultCharacterizationConfiguration configuration)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description List<int[]>
computeNextTestInputs(Map<int[],TestResult> nextTestResults)
In the first iteration all relevant sub combinations of failed test inputs are calculated via thegetRelevantSubCombinations(int[])
method.protected abstract List<IntArrayWrapper>
generateNextTestInputs(Map<int[],TestResult> newTestResults)
The concrete algorithm generates test for which it needs the result for better fault characterization.protected ConstraintChecker
getChecker()
protected TestModel
getModel()
protected abstract Set<IntArrayWrapper>
getRelevantSubCombinations(int[] combination)
Defined which sub-combinations of any given combination can be part of the suspicious set.protected Reporter
getReporter()
protected abstract boolean
shouldGenerateFurtherTestInputs()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.rwth.swc.coffee4j.algorithmic.sequential.characterization.FaultCharacterizationAlgorithm
computeFailureInducingCombinations
-
-
-
-
Field Detail
-
configuration
protected final FaultCharacterizationConfiguration configuration
-
testResults
protected final Map<IntArrayWrapper,TestResult> testResults
-
previousSuspiciousCombinations
protected Set<IntArrayWrapper> previousSuspiciousCombinations
-
suspiciousCombinations
protected Set<IntArrayWrapper> suspiciousCombinations
-
-
Constructor Detail
-
SuspiciousCombinationAlgorithm
protected SuspiciousCombinationAlgorithm(FaultCharacterizationConfiguration configuration)
-
-
Method Detail
-
getModel
protected TestModel getModel()
-
getChecker
protected ConstraintChecker getChecker()
-
getReporter
protected Reporter getReporter()
-
computeNextTestInputs
public List<int[]> computeNextTestInputs(Map<int[],TestResult> nextTestResults)
In the first iteration all relevant sub combinations of failed test inputs are calculated via thegetRelevantSubCombinations(int[])
method. In every iteration the relevant sub combinations of all successful test inputs are then subtracted from the suspicious combinations. Earlier, the suspicious set of last iteration was saved topreviousSuspiciousCombinations
.If the concrete algorithm now decides more test inputs should be generated (
shouldGenerateFurtherTestInputs()
), this is done viagenerateNextTestInputs(java.util.Map<int[], de.rwth.swc.coffee4j.algorithmic.model.TestResult>)
. Otherwise, an empty list is returned.- Specified by:
computeNextTestInputs
in interfaceFaultCharacterizationAlgorithm
- Parameters:
nextTestResults
- the results of either the initial test suite in the first iteration, or all test inputs generated in the previous generation. Must not benull
nor empty- Returns:
- the next set of test inputs for which the result is needed for fault characterization
- Throws:
NullPointerException
- if nextTestResults isnull
IllegalArgumentException
- if nextTestResults is empty
-
getRelevantSubCombinations
protected abstract Set<IntArrayWrapper> getRelevantSubCombinations(int[] combination)
Defined which sub-combinations of any given combination can be part of the suspicious set. For example, BEN only works on all t-value-combinations while AIFL considers all possible sub-combinations.- Parameters:
combination
- for which the relevant sub-combinations are needed- Returns:
- all sub-combination the concrete algorithm considers
-
shouldGenerateFurtherTestInputs
protected abstract boolean shouldGenerateFurtherTestInputs()
- Returns:
- Whether further test inputs should be generated. If not,
FaultCharacterizationAlgorithm.computeFailureInducingCombinations()
will be called next
-
generateNextTestInputs
protected abstract List<IntArrayWrapper> generateNextTestInputs(Map<int[],TestResult> newTestResults)
The concrete algorithm generates test for which it needs the result for better fault characterization. If no further characterization is needed, an empty list should be returned.- Parameters:
newTestResults
- the results from the test inputs generated in the last iteration of the initially generated test inputs if in the first iteration- Returns:
- test inputs for which the result is needed
-
-