File Structure
Understand the test file structure of Erlang and Elixir, as well as the sections in the test file.
We'll cover the following
General file structure
The prop_base
file created in Erlang and the pbt_test.exs
file created in Elixir are the test files of the projects. Both have a similar structure, so let’s look at what that structure is.
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:
- The test module,
module(prop_base)
for Erlang anddefmodule PbtTest
for Elixir. - A test suite which contains three sections:
- The properties we want to test
- The helper functions
- The custom data generators
Get hands-on with 1400+ tech skills courses.