PRT - Path-oriented Random
Testing
PRT is a small SICStus Prolog program that performs uniform
random testing at the level of path within a program under test. The
tool takes as inputs a path condition,
i.e. a set of constraints holding over input variables, and returns a
sequence of test data that is uniformly distributed over the input
space of the program under test.
Path condition can be provided under the form of clpfd constraints,
using the syntax of the clpfd library, but it can also be provided by
external tools.
An important parameter is the so-called division parameter k, which
permits to tune PRT to distinct resolution techniques. When k=1,
constraint refutation
is not used to build a Uniform Random Test data Generator while
when k>1, constraint refutation is applied on 2^k subdomains of the
input space to prune the
search space. In practice, small values of k have to be privileged
in order to avoid combinatorial explosion.
The source code of PRT can be downloaded here,
It contains numerous examples and some explanations on usage.
Two main predicates are available, namely rt/5 and prt/4 with the following
parameters:
- C a path condition (given in clpfd constraints syntax)
- VARS a list of input variables
- N the requested length of Seq
- K the division parameter
Both predicates return a sequence Seq of N test data that respect C.
rt/5 implements "pure" random
testing without using path condition to minimize the number of rejects
while
prt/4 implements Path-oriented
Random Tesing.
Examples:
?- rt(domain([X,Y],0,100), (Y #> X + 50, X*Y #< 60), [X,Y], 1000, Seq1).
?- prt((domain([X,Y],0,100), Y #> X + 50, X*Y #< 60), [X,Y], 1000, 2, Seq3).
Benchmarks can be reproduced using the bench/2
predicate (See Experiments section in the code)