Automatically test web-services with OpenAPI specifications, utilizing pytest and hypothesis.
When run, a series of tests will be automatically generated and run based on the OpenAPI specification of the given web-service. If a test fails, hypothesis
will find and return a minimal example that causes the found issue.
Currently, the following is implemented:
- Check, whether the specification is a valid OpenAPI specification, using openapi-spec-validator
- Parse the specification and automatically generate tests according to the input types of each end-point. This test is considered to fail when the response code is different from 200. For this, the following types are supported:
enum
string
(i.e. text), with minimum / maximum lengthnumber
, with minimum / maximum value (optionally exclusive)boolean
To run the tests on any running web-service, use
nix run github:openeduhub/auto-openapi-tests -- --api "http://<web-service>" --spec-loc "<openapi-json-endpoint>"
See nix run github:openeduhub/auto-openapi-tests -- --help
for more information on possible command line arguments.
Clone this repository, then install the application with
pip install <path/to/repository>
Now, the application can be run through
auto-openapi-tests --api "http://<web-service>" --spec-loc "<openapi-json-endpoint>"