Testing Parallel Executions

One of the most interesting features of stateful tests with PropEr is the ability to take the models we write for sequential ones and automatically turn them into parallel tests that have a decent chance at finding concurrency bugs in your code at nearly no cost. It requires just a few minor changes to the property, and the rest is done for you.

The way it works is conceptually simple. The framework first takes the existing command generation mechanism, and then builds a sequence—something like the following, in abstract terms:

 A -> B -> C -> D -> E -> F -> G

It next picks a common root of operations. Here for example, A -> B is shared by all operations that follow them both. PropEr will take the remaining chain ...

Get Property-Based Testing with PropEr, Erlang, and Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.