API testing

Clean up created data after a test

Medium70 pts~25 min
  • Test isolation
  • Teardown
Practice app · Acme REST API

A live REST + GraphQL API with auth, validation, pagination, rate limiting and an interactive request console.

BASE_URL
/api/practice
Console app
/lab/api-testing-clean-up-created-data-after-a-test

Your starter code already declares BASE_URL — call the API relative to it.

Objective

Delete everything your test created in a teardown step, even if assertions fail.

Your task

  1. 1Create two users with unique emails and record their ids.
  2. 2Run an assertion on each (e.g. role defaults to viewer).
  3. 3In teardown (@AfterEach / fixture / afterEach / finally / [TearDown]) DELETE each id → 204.
  4. 4Verify each id now returns 404.

Acceptance criteria

  • POST /users returns 201
  • DELETE /users/{id} returns 204
  • GET /users/{id} returns 404 afterwards
  • At least 2 assertions pass

Constraints

  • Use a unique email per run, e.g. qa.<timestamp>@example.test — emails must not already exist (409 EMAIL_TAKEN).

Fixtures

apiKey
tqa_live_key_123
basicUser
admin
basicPassword
secret
username
qa@target.dev
password
Test@123

API testing · API Testing · Integration, performance & CI