Svetlana Filimonova

Property-based testing in a Scala project with ScalaCheck

Developer @ ThoughtWorks

Property-based testing in a Scala project with ScalaCheck

On every new project there are tools and libraries that we select for the testing of our application. For people from a non-Haskell background there can be a tendency to choose a main-stream example-based testing approach such as xUnit-kind-of tools offer. In this talk I will cover a different choice that my team made when we ended up with a Scala based project that resulted in a property-based testing and ScalaCheck, which was inspired by QuickCheck from Haskell. We quickly discovered some obvious benefits of using these tests: advantages included the ease of identifying all the edge cases, writing less test-code and enhancing what we cover with it. At the same time we faced several issues during the adoption phase. It was quite challenging to start thinking in terms of properties and determine the right scenarios. Every new test was a demanding which required a large amount of effort to achieve the required outcomes.
This talk is for you if you are unfamiliar with the concept of property-based tests; if you are planning to adopt this practice in the future; or just struggling in becoming efficient with it. It will be about some of the simple ways and techniques that we learned to write these tests so we can start benefiting from having them, and some of the sacrifices we made to make it work in the context of our project and our team.

Talk objectives:

  • The objective of a talk is to explain property-based testing concept, pros and cons, show some simple patterns of writing property tests, inspire people to try it and use it.

Target audience:

  • People who are new to the concept of property-based testing; people who wants to try it out and apply on a real project; people who struggles in becoming efficient with it.