Random input generation
|
  |
AutoTest uses a random strategy to generate input data (target object and arguments) for routine calls performed during
testing. This strategy treats basic (primitive) and non-basic types differently:
- For basic types, values are selected randomly from a fixed set. For instance, for integers, this value set is {-1, 0, 1, -2,
2, 3, 4, 5, 6, 7, 8, 9, 10, -10, 100, -100, {INTEGER}.Min_value, {INTEGER}.Max_value}. Whenever we need an integer, we will
randomly select one of these values.
- For non-basic types, we have to build objects of the corresponding type. This is done by randomly calling one of the creation
procedures of the class.
Objects used in tests are accummulated during the testing process: while running the tests, we keep a pool of objects. This
pool is enriched and diversified as testing proceeds. Whenever we have to call a certain routine under test, we will either
newly create the necessary objects (target and arguments) or reuse existing ones from the pool. The choice between these 2
options is regulated by a heuristics. Objects used for running a routine are returned to the pool (in the new state) after
execution of the test case is finished. Furthermore, in order to diversify the pool, we regularly call modifiers (routines
which don't return a value) on random objects in the pool.