Running the Test for Our API
Let’s run the tests we've written so far and discuss some of their important qualities.
We'll cover the following
Properties of our tests
A test is like a scientific experiment. It does something using the codebase and then makes a series of measurements. In ExUnit
, those experiments are function calls and the measurements are assertions. We’re not concerned about mixing several different kinds of assertions in the same test, especially for tests that are pretty expensive in terms of time.
Tradeoffs of our tests
Our test mixes lifecycle concerns through processes and persistence, but for a good reason. If you value decoupling these concerns more than time, feel free to separate this test’s database and lifecycle portions. The structure of the codebase will make this separation easy to do.
Get hands-on with 1400+ tech skills courses.