Skip to main content

What is the difference between positive and negative API testing? Give examples.

  • positive testing
  • negative testing
  • edge cases

Answer it first, then compare. Nothing here is saved or scored.

Model answer

Positive testing verifies the API works correctly with valid inputs: creating a user with all required fields returns 201. Negative testing verifies graceful handling of invalid inputs: missing required fields (400), invalid email format (422), SQL injection strings (400, not 500), extremely long strings (400), wrong data types (422). A thorough API test suite has more negative tests than positive, the happy path is one path, but there are many ways to fail.

What interviewers listen for

  • Schema-first thinking
    You validate response shape before you assert on values, every time.
  • Status-code literacy
    You can defend why 401 vs 403 vs 422 matters for the consumer.
  • Contract awareness
    You know when consumer-driven contract tests beat end-to-end checks.
  • Auth fluency
    You can describe rotating tokens across parallel workers without secrets in logs.

Terms to know

See all 35 api testing questions

Written by , Senior QA Automation Engineer, 50+ QA candidate interviews conductedLast updated July 2026