liveBook · Manning

Property-based testing

As explained in Automating API Delivery

Property-based testing is a technique that generates many test cases from specified data properties or input strategies.

Property-based testing generates and runs many API cases from an API definition, using data-generation strategies to fuzz requests while checking schema conformance. section 7.4.1

A Schemathesis workflow can:

  • Use explicit OpenAPI examples as request values, making realistic examples useful to both consumers and automated tests. section 7.4.1

Finding a response-schema defect

Testing the Product Catalog API can expose a response that violates its schema because numberOfReviews and reviewRating are unexpected additional properties. The recorded cassette.yaml preserves the request used to reproduce the finding.

How Automating API Delivery covers it

How deep it goes
Explains CLI execution, data generation, request recording, examples, and interpreting schema failures.
Examples
Uses a Product Catalog API, an OpenAPI definition, generated UUID requests, cassette.yaml, and unexpected response properties.
What it assumes
Assumes a running API gateway, API service, and API definition file supplied to the Schemathesis CLI.
What you can do after
Diagnose API schema mismatches and reproduce generated requests from recorded cassettes.
How it connects
Connects API schema testing with OpenAPI, GraphQL, fuzz testing, and the Hypothesis property-based testing library.

Also explained in

Compare how 8 books explain property-based testing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Automating API Delivery. The section links point to the parts of the book it draws on.