public class Ben extends SuspiciousCombinationAlgorithm
Internally, the algorithm works with two important structures: t-value-combinations and so called components (1-value-combinations). In each iteration all components are ranked according to appearance in failed or successful test inputs as well as suspicious combinations. Next, all suspicious t-value combinations (those combinations appearing in only failed test inputs) are ranked according to the suspiciousness of their contained components, and other components in their test inputs. Consider the following example: There is a failed test input (1, 2, 3) when testing with strength 2. (1, 2, -) appears in no successful test input so its a suspicious combinations. 1 appears in many failed test inputs and suspicious combinations in the whole test suite and it is therefore likely that some failure-inducing combinations contains 1. With 2, the same story is the input. 3 does not appear in any failed test input at all. This means (1, 2, -) is very likely the combination causing the failure of (1, 2, 3). Of course, a combination with fewer than t values can also be failure inducing. Therefore, BEN recudes all t-value- combinations at the end. This is done by looking if all possible containing combinations are suspicious. For example, if each parameter has 2 values and (0, 1) and (0, 2) are suspicious, (0, -) is therefore also suspicious since there is no non-suspicious combination containing (0, -).
Important Information: -Will not find any failure-inducing combination involving more than t parameters. If you expect such failure-inducing combinations, your t is already chose wrong -Can generate many additional test inputs if needed. The number of generated test inputs per iteration is configurable -Orders failure-inducing combinations by probability -Considers constraints as an addition to the original algorithm -Not very efficient if failure-inducing combination is smaller than t values
configuration, previousSuspiciousCombinations, suspiciousCombinations, testResults| Constructor and Description |
|---|
Ben(FaultCharacterizationConfiguration configuration)
Builds a new instance of the algorithm for a given configuration.
|
Ben(FaultCharacterizationConfiguration configuration,
int numberOfCombinationsPerStep,
int maxGenerationAttempts)
Builds a new instance of the algorithm for the given configuration.
|
| Modifier and Type | Method and Description |
|---|---|
static FaultCharacterizationAlgorithmFactory |
ben()
Can be used as a convenience method to describe that BEN should be used as a
FaultCharacterizationAlgorithmFactory. |
static FaultCharacterizationAlgorithmFactory |
ben(int numberOfCombinationsPerStep,
int maxGenerationAttempts)
Can be used as a convenience method to describe that BEN should be used as a
FaultCharacterizationAlgorithmFactory. |
List<int[]> |
computeFailureInducingCombinations()
Computes a list of most likely failure inducing combinations refined
from previous calls to
FaultCharacterizationAlgorithm.computeNextTestInputs(Map). |
List<IntArrayWrapper> |
generateNextTestInputs(Map<int[],TestResult> newTestResults)
The concrete algorithm generates test for which it needs the result for better fault characterization.
|
Set<IntArrayWrapper> |
getRelevantSubCombinations(int[] combination)
Defined which sub-combinations of any given combination can be part of the suspicious set.
|
boolean |
shouldGenerateFurtherTestInputs() |
computeNextTestInputs, getChecker, getModel, getReporterpublic Ben(FaultCharacterizationConfiguration configuration)
configuration - for knowing which combinations can be failure-inducing/which test inputs can be generated.
Must not be nullNullPointerException - if configuration is nullpublic Ben(FaultCharacterizationConfiguration configuration, int numberOfCombinationsPerStep, int maxGenerationAttempts)
configuration - for knowing which combinations can be failure-inducing/which test inputs can be generated.
Must not be nullnumberOfCombinationsPerStep - how many test inputs should be generated per step. Must be positivemaxGenerationAttempts - after how many attempts the algorithm should give up on generating a previously
untested test inputs containing a given failure-inducing combination. Must be positiveNullPointerException - if configuration is nullIllegalArgumentException - if one of the integers is not positivepublic static FaultCharacterizationAlgorithmFactory ben()
FaultCharacterizationAlgorithmFactory.public static FaultCharacterizationAlgorithmFactory ben(int numberOfCombinationsPerStep, int maxGenerationAttempts)
FaultCharacterizationAlgorithmFactory.numberOfCombinationsPerStep - see Ben(FaultCharacterizationConfiguration, int, int)maxGenerationAttempts - see Ben(FaultCharacterizationConfiguration, int, int)Ben(FaultCharacterizationConfiguration, int, int)) to create new
FaultCharacterizationAlgorithm instancesIllegalArgumentException - if one of the integers is not positivepublic Set<IntArrayWrapper> getRelevantSubCombinations(int[] combination)
SuspiciousCombinationAlgorithmgetRelevantSubCombinations in class SuspiciousCombinationAlgorithmcombination - for which the relevant sub-combinations are neededpublic boolean shouldGenerateFurtherTestInputs()
shouldGenerateFurtherTestInputs in class SuspiciousCombinationAlgorithmFaultCharacterizationAlgorithm.computeFailureInducingCombinations()
will be called nextpublic List<IntArrayWrapper> generateNextTestInputs(Map<int[],TestResult> newTestResults)
SuspiciousCombinationAlgorithmgenerateNextTestInputs in class SuspiciousCombinationAlgorithmnewTestResults - the results from the test inputs generated in the last iteration of the initially generated
test inputs if in the first iterationpublic List<int[]> computeFailureInducingCombinations()
FaultCharacterizationAlgorithmFaultCharacterizationAlgorithm.computeNextTestInputs(Map). The
combinations returned by this method are not guaranteed to be faulty,
but it is guaranteed that no test input executed which contained this
combination was successful.Copyright © 2019. All rights reserved.