Testing ergonomics is perhaps the most impactful factor in determining whether writing tests is an enjoyable part of day-to-day development, or an annoying slog that's neglected until problems arise.
In this area, Phoenix does not disappoint. We'll focus on several useful patterns for unit and acceptance testing, with the aim of making tests quick, easy, maintainable and intuitive.
TestingController and View Tests
Sometimes we use Phoenix to render HTML, so we'll look at how we can verify that both our controller and view layers (individually) are doing their job.
TestingJSON API Tests
Often we use Phoenix Controllers to render JSON. We'll explore some built-in helpers that are well-suited for helping us write tests verifying that the JSON contains what we expect, and touch on a few libraries that make this even easier!