Class GroupSpecificTestModel
- java.lang.Object
-
- de.rwth.swc.coffee4j.algorithmic.model.GroupSpecificTestModel
-
- All Implemented Interfaces:
TestModel
public class GroupSpecificTestModel extends Object implements TestModel
ATestModel
which acts a a view on theCompleteTestModel
that view the model for one specific error constraint or only the positive test cases.This is primarily needed for seeds and mixed strength groups as they are specific to positive combinatorial testing or error-constraint-specific negative combinatorial testing.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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<PrimitiveStrengthGroup>
getMixedStrengthGroups()
Gets the mixed strength groups which extend thedefault testing strength
.int[]
getParameterSizes()
Gets the parameters used in the combinatorial testing by their respective number of values.List<PrimitiveSeed>
getSeeds()
Gets a list of seed test cases which must be included in the final test suite.double
getWeight(int parameter, int value, double defaultWeight)
Gets the weight of a specific parameter value.int
hashCode()
static GroupSpecificTestModel
negative(int errorConstraintId, CompleteTestModel delegate, ConstraintChecker constraintChecker)
Creates a new view on theCompleteTestModel
which only considers the configuration for negative combinatorial testing for the given error constraint.static GroupSpecificTestModel
positive(CompleteTestModel delegate, ConstraintChecker constraintChecker)
Creates a new view on theCompleteTestModel
which only considers the configuration for positive combinatorial testing.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
-
-
-
-
Method Detail
-
positive
public static GroupSpecificTestModel positive(CompleteTestModel delegate, ConstraintChecker constraintChecker)
Creates a new view on theCompleteTestModel
which only considers the configuration for positive combinatorial testing.- Parameters:
delegate
- theCompleteTestModel
to which this view delegates its callsconstraintChecker
- a constraint checker which checks whether a (partial) test case is valid- Returns:
- a view on the positive combinatorial test configuration
-
negative
public static GroupSpecificTestModel negative(int errorConstraintId, CompleteTestModel delegate, ConstraintChecker constraintChecker)
Creates a new view on theCompleteTestModel
which only considers the configuration for negative combinatorial testing for the given error constraint.- Parameters:
errorConstraintId
- the id of the error constraint for which the configuration is returneddelegate
- theCompleteTestModel
to which this view delegates its callsconstraintChecker
- a constraint checker which checks whether a (partial) test case is valid. In this case "valid" means that the test case must violate the error constraint with the given id- Returns:
- a view on the negative combinatorial test configuration for the given error constraint
-
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)
-
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:
- an array containing the individual sizes of the parameters. Must never be
null
and all entries must be greater than or equal to two (>=2) (i.e. each parameter must have at least two values)
-
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()
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
-
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
-
-