Class 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
    • Method Detail

      • 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)
      • 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 the errorConstraintId is POSITIVE_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 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:
        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 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​(int errorConstraintId)
        Gets the seed test cases for the specific given error constraint or for the positive test cases if the errorConstraintId is POSITIVE_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 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
      • 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()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object