Class DefaultInterleavingManager
- java.lang.Object
-
- de.rwth.swc.coffee4j.algorithmic.interleaving.manager.DefaultInterleavingManager
-
- All Implemented Interfaces:
InterleavingCombinatorialTestManager
public class DefaultInterleavingManager extends Object
Default Implementation of the interfaceInterleavingCombinatorialTestManager
.
-
-
Field Summary
Fields Modifier and Type Field Description protected ConstraintChecker
checker
protected List<int[]>
combinationsToCheck
protected CoverageMap
coverageMap
protected Phase
currentPhase
protected Set<int[]>
failureInducingCombinations
protected Set<int[]>
failureInducingCombinationsToCheck
protected IdentificationStrategy
identificationStrategy
protected InterleavingGenerationReporter
reporter
protected InterleavingCombinatorialTestGroup
testGroup
protected TestInputGenerationStrategy
testInputGenerationStrategy
protected boolean
testInputHasFailed
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
combinationIdentified()
protected void
determineCombinationsToBeChecked()
Add all types of combinations tocombinationsToCheck
.protected Optional<int[]>
generateNextTestInput()
Method used when a new test input is needed during Generation-Phase.Optional<int[]>
generateNextTestInput(int[] testInput, TestResult result)
protected Optional<int[]>
generateNextTestInputForFeedbackChecking(int[] testInput, TestResult result)
Method used when a new test input is needed during Feedback-Checking-Phase.protected Optional<int[]>
generateNextTestInputForIdentification(int[] testInput, TestResult result)
Method used when a new test input is needed during Identification-Phase.Optional<int[]>
initializeFeedbackChecking()
initialize feedback-checking phase.Optional<int[]>
initializeIdentification(int[] testInput, TestResult result)
initialize identification phase for a failing test input.static ExecutingInterleavingManagerFactory
managerFactory()
protected boolean
noCombinationsToBeCheckedPresent()
Optional<int[]>
reinitializeIdentification()
reinitialize identification phase if feedback-checking phase was not successful.protected void
resetCombinationsToBeChecked()
Clear the set of combinations for all types of combinations that need to be checked.protected void
terminateIdentification()
split found combinations into different sets.protected void
terminateInterleavingGroup()
Called when all t-tuples are covered.protected void
updateCoverage()
CallupdateCoverageAfterFailureInducingCombinationIsIdentified(Set)
for each type of combination.void
updateCoverage(int[] combination)
updates the coverage map for a given (passing) test input
-
-
-
Field Detail
-
reporter
protected final InterleavingGenerationReporter reporter
-
coverageMap
protected final CoverageMap coverageMap
-
checker
protected final ConstraintChecker checker
-
testInputGenerationStrategy
protected final TestInputGenerationStrategy testInputGenerationStrategy
-
identificationStrategy
protected final IdentificationStrategy identificationStrategy
-
testGroup
protected final InterleavingCombinatorialTestGroup testGroup
-
failureInducingCombinationsToCheck
protected Set<int[]> failureInducingCombinationsToCheck
-
failureInducingCombinations
protected final Set<int[]> failureInducingCombinations
-
combinationsToCheck
protected final List<int[]> combinationsToCheck
-
currentPhase
protected Phase currentPhase
-
testInputHasFailed
protected boolean testInputHasFailed
-
-
Method Detail
-
terminateInterleavingGroup
protected void terminateInterleavingGroup()
Called when all t-tuples are covered. Post-processing possible. At leastreporter
.interleavingGroupFinished must be called.
-
terminateIdentification
protected void terminateIdentification()
split found combinations into different sets. At leastfailureInducingCombinationsToCheck
must be filled andreporter
.identificationFinished must be called.
-
noCombinationsToBeCheckedPresent
protected boolean noCombinationsToBeCheckedPresent()
- Returns:
- true iff no combinations to check are available.
-
resetCombinationsToBeChecked
protected void resetCombinationsToBeChecked()
Clear the set of combinations for all types of combinations that need to be checked. At leastfailureInducingCombinationsToCheck
must be reset.
-
determineCombinationsToBeChecked
protected void determineCombinationsToBeChecked()
Add all types of combinations tocombinationsToCheck
. At leastfailureInducingCombinationsToCheck
must be added.
-
updateCoverage
protected void updateCoverage()
CallupdateCoverageAfterFailureInducingCombinationIsIdentified(Set)
for each type of combination. At leastfailureInducingCombinationsToCheck
must be used to update.
-
managerFactory
public static ExecutingInterleavingManagerFactory managerFactory()
- Returns:
- returns an
ExecutingInterleavingManagerFactory
for creating this manager.
-
generateNextTestInput
public Optional<int[]> generateNextTestInput(int[] testInput, TestResult result)
- Specified by:
generateNextTestInput
in interfaceInterleavingCombinatorialTestManager
- Parameters:
testInput
- previously executed test input. Null if called for the first time.result
- result of previously executed test input. Null if called for the first time.- Returns:
- next test input needed for the current phase.
Empty Optional, if
- all t-tuples covered,
- or possibly exception/failure-inducing combination is identified,
- or feedback-checking finished.
-
initializeIdentification
public Optional<int[]> initializeIdentification(int[] testInput, TestResult result)
Description copied from interface:InterleavingCombinatorialTestManager
initialize identification phase for a failing test input.- Specified by:
initializeIdentification
in interfaceInterleavingCombinatorialTestManager
- Parameters:
testInput
- failing test input to find exception/failure-inducing combination for.result
-TestResult
of the failing test case containing information needed to decide whether it is failure- or exception-inducing- Returns:
- first test input needed for identification.
-
reinitializeIdentification
public Optional<int[]> reinitializeIdentification()
Description copied from interface:InterleavingCombinatorialTestManager
reinitialize identification phase if feedback-checking phase was not successful.- Specified by:
reinitializeIdentification
in interfaceInterleavingCombinatorialTestManager
- Returns:
- first test input needed for identification.
-
initializeFeedbackChecking
public Optional<int[]> initializeFeedbackChecking()
Description copied from interface:InterleavingCombinatorialTestManager
initialize feedback-checking phase.- Specified by:
initializeFeedbackChecking
in interfaceInterleavingCombinatorialTestManager
- Returns:
- first test input needed for identification.
-
updateCoverage
public void updateCoverage(int[] combination)
Description copied from interface:InterleavingCombinatorialTestManager
updates the coverage map for a given (passing) test input- Specified by:
updateCoverage
in interfaceInterleavingCombinatorialTestManager
- Parameters:
combination
- to update coverage map for
-
combinationIdentified
public boolean combinationIdentified()
- Specified by:
combinationIdentified
in interfaceInterleavingCombinatorialTestManager
- Returns:
- true iff currently checked combination is most likely exception/failure-inducing
-
generateNextTestInput
protected Optional<int[]> generateNextTestInput()
Method used when a new test input is needed during Generation-Phase.- Returns:
- next test input. Null, if all valid t-tuples are covered.
-
generateNextTestInputForIdentification
protected Optional<int[]> generateNextTestInputForIdentification(int[] testInput, TestResult result)
Method used when a new test input is needed during Identification-Phase.- Parameters:
testInput
- previously executed test input.result
- result of previously executed test input.- Returns:
- next test input. Null, if possibly failure-inducing combination is identified.
-
generateNextTestInputForFeedbackChecking
protected Optional<int[]> generateNextTestInputForFeedbackChecking(int[] testInput, TestResult result)
Method used when a new test input is needed during Feedback-Checking-Phase.- Parameters:
testInput
- previously executed test input.result
- result of previously executed test input.- Returns:
- next test input. Null, if maximum number of checks is executed or combination is not failure-inducing.
-
-