Example-based Tests

Get to know the example-based tests and tabular tests.

Example-based tests

When writing tests, we usually write something that we could call example-based tests. In this lesson, we’ll have a new look at them from the perspective of the inputs that we feed to our code. We’ll define terminology to identify example-based tests, which will help us later compare them to property-based tests.

Let’s start with an example. Let’s say we want to test that the Enum.sort/1 function correctly sorts lists. Take a look at property_based_testing/sorting/test/example_based_sort_test.exs ...