The Anatomy of a Test
Explore the fundamental structure of unit tests in Elixir with ExUnit. Learn how to effectively perform the setup, exercise, verify, and teardown stages to create reliable and maintainable tests that confirm your code behaves as expected.
As we begin our journey into the land of unit tests, let’s establish some basic vocabulary and test theory. Software tests, no matter how complicated they are, are comprised of no more than four stages.
- Setup
- Exercise
- Verify
- Teardown
Simple tests may only have two of these stages. Complex ones might have cycles that repeat a stage. ...