Class CompleteTestModel
- java.lang.Object
-
- de.rwth.swc.coffee4j.algorithmic.model.CompleteTestModel
-
- All Implemented Interfaces:
TestModel
public class CompleteTestModel extends Object implements TestModel
A class containing all important information needed for one combinatorial test. This includes the desired testing strength, the parameters and forbidden/error constraints. Forbidden constraints should never appear in any test input as they just cannot be executed, while error constraints should lead to validation or other kinds of errors in an application and should therefore be tested
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CompleteTestModel.Builder
A class for constructing a newCompleteTestModel
instance using the bulider pattern.
-
Field Summary
Fields Modifier and Type Field Description static int
POSITIVE_TESTS_ID
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CompleteTestModel.Builder
builder()
Builder for a newCompleteTestModel
.static CompleteTestModel.Builder
builder(CompleteTestModel oldModel)
boolean
equals(Object object)
ConstraintChecker
getConstraintChecker()
Gets aConstraintChecker
which describes what value combinations of the parameters returned byTestModel.getParameterSizes()
are valid.int
getDefaultTestingStrength()
Gets the desired default testing strength configuration for the combinatorial test.List<Constraint>
getErrorConstraints()
List<TupleList>
getErrorTupleLists()
List<Constraint>
getExclusionConstraints()
List<TupleList>
getExclusionTupleLists()
List<PrimitiveStrengthGroup>
getMixedStrengthGroups()
Gets the mixed strength groups which extend thedefault testing strength
.List<PrimitiveStrengthGroup>
getMixedStrengthGroups(int errorConstraintId)
Gets the mixed strength groups for the specific given error constraint or for the positive test cases if theerrorConstraintId
isPOSITIVE_TESTS_ID
.it.unimi.dsi.fastutil.ints.Int2ObjectMap<List<PrimitiveStrengthGroup>>
getMixedStrengthGroupsMap()
int
getNegativeTestingStrength()
int[]
getParameterSizes()
Gets the parameters used in the combinatorial testing by their respective number of values.int
getPositiveTestingStrength()
List<PrimitiveSeed>
getSeeds()
Gets a list of seed test cases which must be included in the final test suite.List<PrimitiveSeed>
getSeeds(int errorConstraintId)
Gets the seed test cases for the specific given error constraint or for the positive test cases if theerrorConstraintId
isPOSITIVE_TESTS_ID
.it.unimi.dsi.fastutil.ints.Int2ObjectMap<List<PrimitiveSeed>>
getSeedsMap()
double
getWeight(int parameter, int value, double defaultWeight)
Gets the weight of a specific parameter value.int
hashCode()
String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.rwth.swc.coffee4j.algorithmic.model.TestModel
getNumberOfParameters, getParameterSize, getWeight
-
-
-
-
Field Detail
-
POSITIVE_TESTS_ID
public static final int POSITIVE_TESTS_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static CompleteTestModel.Builder builder()
Builder for a newCompleteTestModel
.- Returns:
- a fresh builder instance
-
builder
public static CompleteTestModel.Builder builder(CompleteTestModel oldModel)
-
getDefaultTestingStrength
public int getDefaultTestingStrength()
Description copied from interface:TestModel
Gets the desired default testing strength configuration for the combinatorial test.An testing strength of 2 indicates that all combinations between the values of any two parameters need to be covered in at least one test cases in a combinatorial test suite. The same principle applies to higher testing strengths.
The testing strength can be extended with several
mixed strength groups
. In this case certain subsets of parameters may be tested with a higher strength.- Specified by:
getDefaultTestingStrength
in interfaceTestModel
- Returns:
- the testing strength. Always needs to be positive (>0)
-
getPositiveTestingStrength
public int getPositiveTestingStrength()
- Returns:
- the positive testing strength
-
getNegativeTestingStrength
public int getNegativeTestingStrength()
- Returns:
- the negative testing strength
-
getMixedStrengthGroups
public List<PrimitiveStrengthGroup> getMixedStrengthGroups(int errorConstraintId)
Gets the mixed strength groups for the specific given error constraint or for the positive test cases if theerrorConstraintId
isPOSITIVE_TESTS_ID
.- Parameters:
errorConstraintId
- the identification of the mixed strength groups- Returns:
- the mixed strength grops for the given error constraint or the positive test set
-
getMixedStrengthGroupsMap
public it.unimi.dsi.fastutil.ints.Int2ObjectMap<List<PrimitiveStrengthGroup>> getMixedStrengthGroupsMap()
-
getMixedStrengthGroups
public List<PrimitiveStrengthGroup> getMixedStrengthGroups()
Description copied from interface:TestModel
Gets the mixed strength groups which extend thedefault testing strength
.Each
PrimitiveStrengthGroup
indicates that the defined subset of parameters must be tested at the given higher strength. This can be used if subsets of parameters are known to cause failures involving a high number of parameters, or if certain parameters are especially important. Additionally, this feature can be used to model independent sub-systems inside on model.The strength of each
PrimitiveStrengthGroup
must be higher than thedefault testing strength
. Otherwise, some algorithms might not work correctly anymore.- Specified by:
getMixedStrengthGroups
in interfaceTestModel
- Returns:
- the set of groups for using mixed strength combinatorial testing. Must never be
null
, instead an emptyList
should be returned if no groups are defined
-
getParameterSizes
public int[] getParameterSizes()
Description copied from interface:TestModel
Gets the parameters used in the combinatorial testing by their respective number of values.For example, a configuration of [2, 3, 4, 2, 7] indicates that the first parameter has two values, the second one has three values, and so on. Test cases generated for this
TestModel
should always contain the parameters in the same order as this configuration.This algorithmic layer of combinatorial testing does not deal with concrete values. Such a translation can be done at a higher level in the framework.
- Specified by:
getParameterSizes
in interfaceTestModel
- Returns:
- the number of values for each parameter
-
getWeight
public double getWeight(int parameter, int value, double defaultWeight)
Description copied from interface:TestModel
Gets the weight of a specific parameter value.Values with higher weights should appear more frequently and/or earlier in a test suite.
- Specified by:
getWeight
in interfaceTestModel
- Parameters:
parameter
- the index of the parameter starting at zerovalue
- the index of the value in the parameter starting at zerodefaultWeight
- a weight which is returned if no weight is specified- Returns:
- the weight for the value.
defaultWeight
if no other weight is specified
-
getSeeds
public List<PrimitiveSeed> getSeeds(int errorConstraintId)
Gets the seed test cases for the specific given error constraint or for the positive test cases if theerrorConstraintId
isPOSITIVE_TESTS_ID
.- Parameters:
errorConstraintId
- the identification of the seed list- Returns:
- the seeds for the given error constraint or the positive test set
-
getSeedsMap
public it.unimi.dsi.fastutil.ints.Int2ObjectMap<List<PrimitiveSeed>> getSeedsMap()
-
getSeeds
public List<PrimitiveSeed> getSeeds()
Description copied from interface:TestModel
Gets a list of seed test cases which must be included in the final test suite.Each seed test case array must have the same length as the one returned by
TestModel.getParameterSizes()
and the parameter must appear in the same order. The values for each parameter are indicted with an integer number, with 0 being the first value. The value must always be lower (<) than the number returned byTestModel.getParameterSizes()
for the same parameter (e.g. ifTestModel.getParameterSizes()
returns [2, 3, 4] then [2, 1, 0] would not be a valid seed since 2 is not smaller than 2 but [1, 2, 3] would be valid). The values must also never be negative, except if they indicate a missing value in a partial seed test. Then -1 is allowed as a representation of the missing value.Algorithms which use these seeds should always count then towards the coverage criterion defined by
TestModel.getDefaultTestingStrength()
.Must not contain any seed test case which is already invalid according to the
ConstraintChecker
or which cannot be extended to a valid test case
-
getExclusionTupleLists
public List<TupleList> getExclusionTupleLists()
- Returns:
- all exclusion combinations. Tests containing these combinations cannot be executed
-
getErrorTupleLists
public List<TupleList> getErrorTupleLists()
- Returns:
- all error combinations. Tests containing these combinations can be executed but should cause an error
-
getExclusionConstraints
public List<Constraint> getExclusionConstraints()
-
getErrorConstraints
public List<Constraint> getErrorConstraints()
-
getConstraintChecker
public ConstraintChecker getConstraintChecker()
Description copied from interface:TestModel
Gets aConstraintChecker
which describes what value combinations of the parameters returned byTestModel.getParameterSizes()
are valid.A combinatorial test suite generated from this model must never contain a test case which is invalid according to this
ConstraintChecker
.- Specified by:
getConstraintChecker
in interfaceTestModel
- Returns:
- the constraint checker which must be used to check whether a test case is valid. Must never be
null
. Instead, aNoConstraintChecker
should be returned
-
-