Hostname: page-component-77f85d65b8-6bnxx Total loading time: 0 Render date: 2026-03-27T18:27:36.113Z Has data issue: false hasContentIssue false

Impact and Performance of Randomized Test Generation Using Prolog

Published online by Cambridge University Press:  18 August 2025

MARCUS GELDERIE
Affiliation:
Aalen University of Applied Sciences Aalen, Germany (e-mails: maximilian.luff@hs-aalen.de, marcus.gelderie@hs-aalen.de, maximilian.peltzer@hs-aalen.de)
MAXIMILIAN LUFF
Affiliation:
Aalen University of Applied Sciences Aalen, Germany (e-mails: maximilian.luff@hs-aalen.de, marcus.gelderie@hs-aalen.de, maximilian.peltzer@hs-aalen.de)
MAXIMILIAN PELTZER
Affiliation:
Aalen University of Applied Sciences Aalen, Germany (e-mails: maximilian.luff@hs-aalen.de, marcus.gelderie@hs-aalen.de, maximilian.peltzer@hs-aalen.de)
Rights & Permissions [Opens in a new window]

Abstract

We study randomized generation of sequences of test inputs to a system using Prolog. Prolog is a natural fit to generate test sequences that have complex logical interdependent structure. To counter the problems posed by a large (or infinite) set of possible tests, randomization is a natural choice. We study the impact that randomization in conjunction with SLD resolution have on the test performance. To this end, this paper proposes two strategies to add randomization to a test-generating program. One strategy works on top of standard Prolog semantics, whereas the other alters the SLD selection function. We analyze the mean time to reach a test case and the mean number of generated test cases in the framework of Markov chains. Finally, we provide an additional empirical evaluation and comparison between both approaches.

Information

Type
Rapid Communication
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2025. Published by Cambridge University Press
Figure 0

Listing. 1. A program generating randomized sequences of test inputs.

Figure 1

Listing. 2. Guard clauses.

Figure 2

Fig. 1. The Markov chain corresponding to $\mathcal{P}$ with $\mathsf{Init}=\sharp$ and blocks$\alpha \in \{1,\ldots ,r\}^*$ surrounded by blue boxes.

Figure 3

Fig. 2. The Markov chain corresponding to $\mathcal{P}$ in the Drop-and-Shuffle approach. Dashed arrows represent backtracking. Double circled nodes produce an output. Hatched nodes are recursive sub-tree roots, which start an entire infinite sub-tree with the same structure as the whole chain (shown as gray triangles).

Figure 4

Fig. 3. Recursive sub-tree roots are connected to all ordered subsets of $\{1,\ldots ,r\}$ (most arrows omitted for readability). Each subset of size $k$ starts chain of $k$ subsets. One element (here $1$) is the desired next item of the test sequence, and each chain contains at most one state with the desired item at the top (depicted in green).

Figure 5

Fig. 4. Iterations and results until test case [second, …, second] is reached.

Figure 6

Listing. 3. A program generating arithmetic expressions.

Figure 7

Table 1. Example expressions of smallest possible size for the target values (in Polish notation)

Figure 8

Fig. 5. Iterations and results until the generated expression has a specific value.