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

2

12

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?

Elroyels answered 28/3, 2014 at 12:31 Comment(5)
Does agitar use randomized testing? How are properties formulated there? Please tell us moreTraumatize
Apparently quickcheck for Java doesn't support shrinking. Also, AFAICT, it doesn't "expand" either, by which I mean it doesn't start by testing the simplest cases and then gradually make the tests more complicated. I don't know if any of the others support shrinking and expanding, but that could be an important feature to check.Yirinec
From the description it sounds like Agitar generates unit tests based on code; Quickcheck doesn't generate tests, it tests properties with randomly generated inputs.Newhouse
Thanks @Yirinec please expand that into an answer and I'll mark it as correct.Elroyels
Thanks @Newhouse - please expand that into an answer and I'll mark it as correct.Elroyels
Y
12

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.

Yirinec answered 24/4, 2014 at 11:9 Comment(0)
P
5

Its worth noting that as of version 0.6, junit-quickcheck now supports shrinking:

http://pholser.github.io/junit-quickcheck/site/0.6-alpha-3-SNAPSHOT/usage/shrinking.html

quickcheck doesn't look to have had any new releases since 2011:

https://bitbucket.org/blob79/quickcheck

Pearman answered 9/1, 2016 at 1:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.