Property testing with Java and vavr.io

Lars L√łnne

Short workshop - in English

Property based testing is a different way to write tests for your applications, where you make claims about the code, and let the testing framework generate thousands of test cases for you. In this workshop we will learn how to do property based testing in Java, and how you can start using this testing technique today.

In traditional unit testing, the developer makes up a handful of examples, and run her code with these examples to verify that the code produces the expected results. Creating the examples can be harder than it sounds, and is often time consuming. It can also cause developers to just test the "easy" cases, because making up test cases for harder problems is too demanding.

With property based testing, we describe the structure of the test data, and make a series of claims about the code we have written. Then, we let the testing framework do the heavy lifting, by generating thousands of test cases, and making sure our claims hold for every one. This way, over time, your code will be tested with every weird and wonderful example you can think of, and also all the examples you couldn't think of.

In this workshop, we will learn more about property based testing, and how to implement it in a Java project, using the vavr.io library. We will develop a small system, and thoroughly test it with property tests along the way. You will learn how to do property testing, how to set it up in your project, and how to compose complex test data with arbitraries and generators.

Primarily for: Developers, Tester/test leads

Participant requirements: A laptop.