New article: Using Hypothesis and Schemathesis to Test FastAPI
Property-based tests are based on the properties of a given function or a program. For example, if a function takes an argument of type int, then the function should pass for tests involving all integers.
Hypothesis is a tool for conducting property-based testing in Python. It generates a lot of arbitrary test cases to test our functions.
Schemathesis is a modern API testing tool based on the OpenAPI and GraphQL specifications. Since FastAPI generates an OpenAPI schema, we can run automatic tests on the endpoints.
Property-based tests are based on the properties of a given function or a program. For example, if a function takes an argument of type int, then the function should pass for tests involving all integers.
Hypothesis is a tool for conducting property-based testing in Python. It generates a lot of arbitrary test cases to test our functions.
Schemathesis is a modern API testing tool based on the OpenAPI and GraphQL specifications. Since FastAPI generates an OpenAPI schema, we can run automatic tests on the endpoints.