Class GroupSpecificTestModel

  • All Implemented Interfaces:
    TestModel

    public class GroupSpecificTestModel
    extends Object
    implements TestModel
    A TestModel which acts a a view on the CompleteTestModel 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 Detail

      • positive

        public static GroupSpecificTestModel positive​(CompleteTestModel delegate,
                                                      ConstraintChecker constraintChecker)
        Creates a new view on the CompleteTestModel which only considers the configuration for positive combinatorial testing.
        Parameters:
        delegate - the CompleteTestModel to which this view delegates its calls
        constraintChecker - 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 the CompleteTestModel 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 returned
        delegate - the CompleteTestModel to which this view delegates its calls
        constraintChecker - 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 interface TestModel
        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 the default 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 the default testing strength. Otherwise, some algorithms might not work correctly anymore.

        Specified by:
        getMixedStrengthGroups in interface TestModel
        Returns:
        the set of groups for using mixed strength combinatorial testing. Must never be null, instead an empty List 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 interface TestModel
        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 interface TestModel
        Parameters:
        parameter - the index of the parameter starting at zero
        value - the index of the value in the parameter starting at zero
        defaultWeight - 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 by TestModel.getParameterSizes() for the same parameter (e.g. if TestModel.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

        Specified by:
        getSeeds in interface TestModel
        Returns:
        the (partial) seed test cases for the model. Will never be null and no entry will be null. Furthermore the conditions described above must always hold
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object