Property-based Testing support for Quarkus / Tech doku about the Quarkus test-engine

155 views Asked by At

We have a Quarkus project in production. It runs fine but testing is a nightmare because of high complexity of the data structure and business logic. We would like to add property-based testing to our project. I have so far failed to find a Java PBT testing library that supports Quarkus though.

I have tried *jqwik *and junit-quickcheck. They both run technically but they cannot access our project code, i.e. access the injected beans (they remain NULL during the test run), due to different test engines. See also: Inject returns NULL when activating jqwik in Quarkus test

I have tried to write an own quarkus-extension for jqwik. I got along with the jqwik part but failed for the lack of understanding the Quarkus Test Engine.

My question:

  1. Is there working support property-based testing support in Quarkus?
  2. If not, can anyone provide an in-depth guide about the Quarkus test engine? Writing an own extension will take a while but (given the referring PBT library owner approves) I could probably make the resulting extension public.
1

There are 1 answers

0
johanneslink On

You may want to look at quicktheories: https://github.com/quicktheories/QuickTheories.

What differentiates it from both jqwik and junit-quickcheck is its independence from any test framework or test engine. The obvious advantage is that you can just add it to whatever you're already using for example-based testing your Quarkus app. The disadvantage is that you get no additional lifecycle support like instantiating objects provided by DI for each try of a property. Moreover, quicktheories seems to be orphaned. So it could be a short-term solution to get started with PBT within Quarkus, but you probably also want to continue the development of integrated support for the Quarkus test engine.