Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  • quickcheck
  • jcheck
  • junit-quickcheck

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

like image 391
hawkeye Avatar asked Mar 28 '14 12:03

hawkeye


People also ask

What is property-based testing?

What is property-based testing? Property-based tests are designed to test the aspects of a property that should always be true. They allow for a range of inputs to be programmed and tested within a single test, rather than having to write a different test for every value that you want to test.

What is property-based testing Java?

Property-Based Testing in Java Property-Based Testing tries to combine the intuitiveness of Microtests with the effectiveness of randomized, generated test data.


1 Answers

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.

like image 121
mhwombat Avatar answered Sep 28 '22 06:09

mhwombat