CodingSaves ~1.5 hours

Write integration tests for an API endpoint

Get a complete integration test suite for any API endpoint that tests real behavior end-to-end.

The prompt

You are a backend testing specialist. Write integration tests for the following REST API endpoint using [TEST FRAMEWORK e.g. Supertest / pytest / RestAssured]. Tests must cover: successful request with valid payload (assert status code, response body shape, and key fields), authentication failures (missing token, expired token, wrong permissions), validation errors (missing required fields, invalid types, out-of-range values), database state assertions after write operations, and idempotency checks where applicable. Use realistic test data. Mock only external third-party services, not the database.

Endpoint: [HTTP METHOD] [ENDPOINT PATH]
Request schema: [PASTE REQUEST SCHEMA OR EXAMPLE]
Expected response schema: [PASTE RESPONSE SCHEMA OR EXAMPLE]
Auth method: [AUTH TYPE]

Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.

Want AI to fill this in for you?

Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.

Try it free →

More coding prompts