Reductio is open source (BSD) software written using the Java Programming Language from an idea that originated in a research paper called QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. Reductio (and QuickCheck) utilises a testing technique called Automated Specification-based Testing, which has many advantages over traditional testing techniques.
The primary objective of Reductio is to make testing as rigorous as possible, while alleviating developer effort through automation of many common testing tasks. Reductio includes usage examples that demonstrate how this objective has been met using both traditional Java 1.5 and Java 7 BGGA syntax as well as Scala programming language examples.
To use Reductio, you will require a JDK version 1.5 (or higher) or a bytecode modification tool such as Retroweaver to allow you to use an earlier JDK version.
Reductio includes a specialised API Specification for the Scala Programming Language. Although any Java API can be used from the Scala language, the specialised Scala API takes advantage of advanced programming language features.
The following example uses Java 7 BGGA syntax to execute 100 unit tests on
java.util.LinkedList. It asserts that when a list
(x) is appended to another list (y), then the
size() of the resulting list (xy) is equivalent to
the sum of the size() of the two original lists.
Property p = property(arbLinkedList(arbInteger), arbLinkedList(arbInteger),
{
LinkedList<Integer> x, LinkedList<Integer> y =>
final LinkedList<Integer> xy = new LinkedList<Integer>(x);
xy.addAll(y);
prop(xy.size() == x.size() + y.size())
});
// OK, passed 100 tests
summary.println(p.check());