Interface TestModel

  • All Known Implementing Classes:
    CompleteTestModel, GroupSpecificTestModel

    public interface TestModel
    Defines all important information needed for a combinatorial test.

    This is in an interface to hide different possible implementations to the algorithms which use an instance of the implementations. Possible implementations include the CompleteTestModel and other models which only map to part of the CompleteTestModel. It is therefore suited for use in TestInputGroupGenerator when multiple different groups are generated by the same generation algorithm for different subspaces in the parameter space (e.g. different groups for positive and negative testing).

    All implementations must be immutable with regards to the values returned by all methods given in this interface.

    • Method Detail

      • getDefaultTestingStrength

        int getDefaultTestingStrength()
        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.

        Returns:
        the testing strength. Always needs to be positive (>0)
      • getMixedStrengthGroups

        List<PrimitiveStrengthGroup> getMixedStrengthGroups()
        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.

        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

        int[] getParameterSizes()
        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.

        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)
      • getNumberOfParameters

        default int getNumberOfParameters()
        Gets the number of parameter defined by this TestModel.

        This must always be the same as the length of the array returned by getParameterSizes(). While one could also just always get the length of the array, this is meant as a convenience method to make the code more readable.

        Returns:
        the number of parameters defined in this TestModel. Must be at least 1 (>=1)
      • getParameterSize

        default int getParameterSize​(int parameter)
        Gets the size (number of values) of one specific parameter.

        Must always return the same as the array value returned by getParameterSizes() at the given index.

        Parameters:
        parameter - the index of the parameter starting at zero
        Returns:
        the number of values the given parameter has. Will always be at least 2 (>=2)
      • getWeight

        double getWeight​(int parameter,
                         int value,
                         double defaultWeight)
        Gets the weight of a specific parameter value.

        Values with higher weights should appear more frequently and/or earlier in a test suite.

        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
      • getWeight

        default double getWeight​(int parameter,
                                 int value)
        Gets the weight of a specific parameter value.

        Values with higher weights should appear more frequently and/or earlier in a test suite.

        Parameters:
        parameter - the index of the parameter starting at zero
        value - the index of the value in the parameter starting at zero
        Returns:
        the weight for the value. Zero if no weight is given
      • getSeeds

        List<PrimitiveSeed> getSeeds()
        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 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 getParameterSizes() for the same parameter (e.g. if 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 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

        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
      • getConstraintChecker

        ConstraintChecker getConstraintChecker()
        Gets a ConstraintChecker which describes what value combinations of the parameters returned by getParameterSizes() are valid.

        A combinatorial test suite generated from this model must never contain a test case which is invalid according to this ConstraintChecker.

        Returns:
        the constraint checker which must be used to check whether a test case is valid. Must never be null. Instead, a NoConstraintChecker should be returned