It’s time to question one of my darlings…

The Situation

Looking at languages like Haskell or Erlang Property-based testing (PBT) is at the forefront of how developers test their own code. In Elixir it is even supposed to become part of the standard library.

I have been promoting PBT for quite a while:

And yet, the uptake of the approach in the Java community is very low. Doing an Github search for the usage of the three most common PBT libs in Java (junit-quickcheck, jqwik and quicktheories) only returns about 3500 code hits. Compared to the 900k of Jupiter alone this is almost non-existent. And ScalaCheck - the PBT of choice for Scala development - finds itself with 33k usages in Github, although there are much fewer Scala projects on Github.

Reasons

So maybe it’s about OO languages not lending themselves well to this approach?
If you look at the number of hits for “hypothesis” (the best known Python PBT library) in Python source code you get 37k findingins.
That’s why this argument seems not plausible to me.

Maybe the Java libraries are not mature enough or miss out on important features? I don’t think that’s true either. I have been testing and using all kinds of PBT libraries in a few languages for some years: There is no fundamental disadvantage in overall performance or number of features. Speaking of maturity: junit-quickcheck started in 2010, QuickTheories in 2015 and jqwik in 2016. Not exactly new kids on the block.

What is the remaining difference to languages with much PBT usage? In my opinion it’s the Java community. Java has become the epitome of “Enterprise” development and conservative programming. When in doubt Java folks go with the main stream tool and use the library everybody else is using. That’s not always a bad thing because it provides stability for customers and developers alike.

The downside of stability is stagnation. Clinging to what they know keeps people from learning what might be helpful. For a topic to reach critical mass in the Java world an extraordinary high amount of interest, visibility and marketing is required.

The Future

For me there are two open questions:

Any comments and suggestions are welcome!