Search⌘ K

File Structure

Explore the structure of property-based test files in Elixir and Erlang projects using PropEr. Understand how to organize properties, helper functions, and custom data generators to write clear and maintainable test suites. This lesson helps you grasp the recommended file layout and roles of each section for effective property-based testing.

General file structure

The prop_base file created in Erlang and the pbt_test.exs file created in Elixir are the project’s test files. Both have a similar structures as we’ll see below,

Elixir creates the test files by itself. However, Erlang does not. In the root of any standard Erlang project, call the rebar3 new proper base command to generate a test file named prop_base.erl.

The files contain two parts:

  1. The test module,
...