Search⌘ K
AI Features

Error Test for JSON-based APIs

Explore how to create error tests for JSON APIs in Phoenix with ExUnit. Understand how to verify HTTP status codes, check response data structure, and ensure no unwanted database changes occur after invalid inputs.

We'll cover the following...

It’s common to have the success tests before the error tests, but that doesn’t mean we have to write them in that order.

Defining an error test

We’re going to start ...