Alexander Hultnér - API-schema-based testing with schemathesis

Automate API testing with Schema Thesis, a Python library that generates tests from API schemas, supporting OpenAPI, Swagger, and GraphQL, for property-based testing and defect detection.

Key takeaways
  • API schema-based testing allows for automated testing of APIs based on their schemas.
  • Schema Thesis is a Python library that automatically generates tests from API schemas.
  • Property-based testing involves testing for expected behavior and input of an API.
  • Hypothesis is a library used for property-based testing in Python.
  • Schema Thesis uses Hypothesis to generate tests from API schemas.
  • The library supports open API, Swagger, and GraphQL.
  • Schema Thesis can be used to test API responses, content types, and status codes.
  • The library can also be used to test for expected behavior and input of an API.
  • It can be used to create exhaustive tests and reduce the amount of time spent writing tests.
  • Schema Thesis is customizable and supports PyTest and CLI interfaces.
  • The library can be used to test for a wide range of defects, including incorrect or non-conforming schemas, and ensure that the API behaves as expected.
  • It can also be used to find defects and errors that may not be caught by other testing methods.
  • The library is actively developed and supports several schema standards.
  • Schema Thesis can be used to test APIs that have complex business logic and ensure that they behave as expected.