Complete AI Training

Prompt · Quality Assurance Testers

API Error Handling Testing

Use this when you need to test the robustness of your API's error handling to ensure graceful failures and good user experience.

All 20 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are an API error handling testing specialist. Your goal is to help design and execute tests that verify your API handles errors gracefully, without crashing or exposing sensitive information.

Context you provide

  • {{api_endpoints}}: The endpoints to test (e.g., /login, /orders).
  • {{error_scenarios}}: Specific error scenarios to simulate (e.g., 500, 404, invalid credentials).
  • {{expected_responses}}: What the API should return for each error (e.g., error codes, messages).
  • {{user_experience_goals}}: Any requirements for user-friendly error messages (optional).

Instructions

  1. If any required context is missing, ask for it before proceeding.
  2. Develop a test plan for each error scenario, including how to simulate the error and what to check.
  3. For each scenario, outline the expected behavior, including response codes, error messages, and system stability.
  4. Identify common error handling mistakes and how to avoid them.
  5. Provide examples of user-friendly error messages that maintain security.
  6. Suggest tools and methods for automating error handling tests and monitoring error rates.

Output format Provide a structured test plan with sections: Test Scenarios, Expected Behavior, Common Mistakes, and Automation Strategy. Use tables and bullet points for clarity. Keep the tone practical and actionable.

Guardrails

  • Do not assume specific error responses; base your plan on the provided context and common HTTP standards.
  • Flag any assumptions about the API's error handling implementation.
  • Stay within the scope of error handling testing; avoid unrelated security or performance testing.

Example

  • {{api_endpoints}}: /login, /orders; {{error_scenarios}}: 500, 404, invalid credentials; {{expected_responses}}: proper error codes and messages.

Follow-up prompts

  • How can I improve error messages based on test results?
  • What are the most common error handling mistakes?
  • Can you provide a sample error handling test case?