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 ConstraintCheckercheckerprotected List<int[]>combinationsToCheckprotected CoverageMapcoverageMapprotected PhasecurrentPhaseprotected Set<int[]>failureInducingCombinationsprotected Set<int[]>failureInducingCombinationsToCheckprotected IdentificationStrategyidentificationStrategyprotected InterleavingGenerationReporterreporterprotected InterleavingCombinatorialTestGrouptestGroupprotected TestInputGenerationStrategytestInputGenerationStrategyprotected booleantestInputHasFailed
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancombinationIdentified()protected voiddetermineCombinationsToBeChecked()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 ExecutingInterleavingManagerFactorymanagerFactory()protected booleannoCombinationsToBeCheckedPresent()Optional<int[]>reinitializeIdentification()reinitialize identification phase if feedback-checking phase was not successful.protected voidresetCombinationsToBeChecked()Clear the set of combinations for all types of combinations that need to be checked.protected voidterminateIdentification()split found combinations into different sets.protected voidterminateInterleavingGroup()Called when all t-tuples are covered.protected voidupdateCoverage()CallupdateCoverageAfterFailureInducingCombinationIsIdentified(Set)for each type of combination.voidupdateCoverage(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 leastfailureInducingCombinationsToCheckmust 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 leastfailureInducingCombinationsToCheckmust be reset.
-
determineCombinationsToBeChecked
protected void determineCombinationsToBeChecked()
Add all types of combinations tocombinationsToCheck. At leastfailureInducingCombinationsToCheckmust be added.
-
updateCoverage
protected void updateCoverage()
CallupdateCoverageAfterFailureInducingCombinationIsIdentified(Set)for each type of combination. At leastfailureInducingCombinationsToCheckmust be used to update.
-
managerFactory
public static ExecutingInterleavingManagerFactory managerFactory()
- Returns:
- returns an
ExecutingInterleavingManagerFactoryfor creating this manager.
-
generateNextTestInput
public Optional<int[]> generateNextTestInput(int[] testInput, TestResult result)
- Specified by:
generateNextTestInputin 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:InterleavingCombinatorialTestManagerinitialize identification phase for a failing test input.- Specified by:
initializeIdentificationin interfaceInterleavingCombinatorialTestManager- Parameters:
testInput- failing test input to find exception/failure-inducing combination for.result-TestResultof 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:InterleavingCombinatorialTestManagerreinitialize identification phase if feedback-checking phase was not successful.- Specified by:
reinitializeIdentificationin interfaceInterleavingCombinatorialTestManager- Returns:
- first test input needed for identification.
-
initializeFeedbackChecking
public Optional<int[]> initializeFeedbackChecking()
Description copied from interface:InterleavingCombinatorialTestManagerinitialize feedback-checking phase.- Specified by:
initializeFeedbackCheckingin interfaceInterleavingCombinatorialTestManager- Returns:
- first test input needed for identification.
-
updateCoverage
public void updateCoverage(int[] combination)
Description copied from interface:InterleavingCombinatorialTestManagerupdates the coverage map for a given (passing) test input- Specified by:
updateCoveragein interfaceInterleavingCombinatorialTestManager- Parameters:
combination- to update coverage map for
-
combinationIdentified
public boolean combinationIdentified()
- Specified by:
combinationIdentifiedin 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.
-
-