April 2024
Beginner to intermediate
224 pages
5h 7m
English
It’s more complex to test endpoints than it is to test pure functions or Ecto queries, but Phoenix provides several helper functions to make it as easy as possible. You’ll find more complexity in deciding what to test (complex HTML responses, valid versus invalid parameters, full integration testing versus mock testing, and so on) than you will in writing the actual tests. However, lean toward testing more than less so that you have confidence in your system.
We’ll set up the test module and then walk through a few types of controller tests. But first, let’s create a little helper to make our tests simpler.
It’s common as you write tests to create the same test data over and over again. Usually, setting ...
Read now
Unlock full access