Manuals / API Testing / Chapter 8

D · Contracts · intermediate · Week 6–7 · Chapter 8 of 11

OpenAPI, schemas & contract testing

OpenAPI (Swagger) describes API contracts. Validate responses against schemas — catch drift before production.

Path progress
66%

Step 1 of 4

Read an OpenAPI spec

paths, components/schemas, responses. Petstore is the hello world.

Read an OpenAPI specDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Read an OpenAPI spdrag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Do this now

Open swagger.io petstore spec. Map 3 endpoints to tests you already wrote.

Was this step clear?
Chapter learning outcomes
  • OpenAPI structure
  • JSON Schema validation
  • Contract vs E2E
  • Consumer-driven contracts intro

Clear these before you leave

Side quest

Schema break drill

Remove required field from schema temporarily. Confirm test fails. Restore.