HomeChallengesRepsProblemsLeaderboardTake a challenge

The paths nobody tests

404, 401, 409 and the shape of the error body. The half of the API that only shows up in production.

Intermediate18 min on the clock5 graded checks · 100 pointsTesting an ASP.NET Core APIPro
Graded by reading your code against the checklist below.

What you build

  • Assert a 404 for something that does not exist
  • Assert the error body is ProblemDetails, with a status and a title
  • Assert a 401 when no token is sent
  • Assert a 409 when a duplicate is created
  • Stop relying on IsSuccessStatusCode

Done means

Three failure paths asserted by exact status code, and the error body checked as ProblemDetails.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. A 404 is asserted for something missing+20Failing in a shape callers can read
  2. A 401 is asserted when no token is sent+20Roles and policies
  3. The error body is checked as ProblemDetails+25Failing in a shape callers can read
  4. A 409 is asserted for a duplicate+20Failing in a shape callers can read
  5. It no longer leans on IsSuccessStatusCode+15Failing in a shape callers can read

What it teaches

The rest of Testing an ASP.NET Core API