Generators

Generators are classes that provide test data. Generators must be defined for classes run by OnlineRunner, or other runners generating test data in runtime. Some generators must be provided with parameters. Generator parameters may be either required or optional. Required parameters must be provided for a generator to run. If user does not provide optional parameter, default value is used.

Cartesian product generator

Defined by CartesianProductGenerator.class

This generator will generate test data that are cartesian product (all possible combinations) of equivalence classes representing parameters of the test function. The generator does not require any parameters.

N-wise generator

Defined by NWiseGenerator.class

The generator generates such combinations that all possible n-tuples of the test function input domain represented by equivalence classes are covered. The result is quasi-optimal in the sense of minimal number of test cases, however it cannot be guaranteed that all n-tuples cannot be covered by less test cases. In case where constraints defined for the equivalence classes in the model prohibit existence of test cases covering specific tuple, such tuple will not be generated and the user will not be notified in any way about it.

Required parameters:

  • N – integer between 1 and diemension of input domain (number of function parameters). For example for pairwise coverage, the value of this parameter must be set to 2.

Optional parameters:

  • coverage – integer between 1 and 100, 100 by default. It determines minimal percent value of the total n-tuples to be covered by generated test cases.

Random generator

Defined by RandomGenerator.class

Generates random values from valid state space. The result is uniform if the valid combinations are distributed uniformly over the space of possible combinations.

Required parameters:

  • length – a positive integer defining number of test cases to generate

Optional parameters:

  • duplicates – boolean parameter (by default false) indicating whether duplicates are allowed. In case of false the number of generated test cases will not be higher than size of the valid combinations space. The value false is default.

Adaptive random generator

Defined by AdaptiveRandomGenerator.class

Generalization of RandomGenerator.class. It generates a set of candidates for test cases and selects the one with the biggest distance to already executed test cases. The distance between test cases is defined by number of different elements in the vector (i.e. two identical vectors have distance 0 and two completely different vectors of n elements have distance n).

Required parameters:

  • length – positive integer defining number of test cases to generate

Optional parameters:

  • duplicates – with the same meaning as for RandomGenerator.class
  • depth – -1 or any non-negative number defining number of executed test cases to which the candidates will be optimized. Default value -1 means that all history will be considered. Assigning 0 to this parameter makes the generator purely random generator.
  • candidate set size – positive number of candidate test cases generated each time when new test case is requested. Each of the potential test cases from the candidate set will be measured for optimum distance from the already executed test cases. Default value is 100.