Search code examples
javahaskellquickcheckproperty-based-testing

What is the difference between Agitar and Quickcheck property based testing?


A number of years ago a Java testing tool called Agitar was popular. It appeared to do something like property based testing.

Nowadays - property based testing based on Haskell's Quickcheck is popular. There are a number of ports to Java including:

My question is: What is the difference between Agitar and Quickcheck property based testing?


Solution

  • To me, the key features of Haskell QuickCheck are:

    1. It generates random data for testing

    2. If a test fails, it repeatedly "shrinks" the data (e.g., changing numbers to zero, reducing the size of a list) until it finds the simplest test case that still fails. This is very useful, because when you see the simplest test case, you often know exactly where the bug is and how to fix it.

    3. It starts testing with simple data, and gradually moves on to more complex data. This is useful because it means that tests fail more quickly. Also, it ensures that edge cases (e.g., empty lists, zeroes) are properly tested.

    Quickcheck for Java supports (1), but not (2) or (3). I don't know what features are supported by Agitar, but it would be useful to check.

    Additionally, you might look into ScalaCheck. Since Scala is interoperable with Java, you could use it to test your Java code. I haven't used it, so I don't know which features it has, but I suspect it has more features than Java Quickcheck.