Open tommyjcarpenter opened 5 years ago
There is an example script of generating tavern tests from an openapi spec here https://github.com/taverntesting/tavern/tree/master/example/generate_from_openapi but it's not really something that Tavern was designed to do. There isn't really an easy way to map the number of endpoints tested to the number of endpoints in the API spec other than maybe writing another Pytest plugin that checked which requests were made to which endpoints and comparing it to the swagger file.
On a related note - if you do want to run example tests from inside a swagger file then I think Dredd does something like that which might be better suited to your needs: https://dredd.org/en/latest/
I think a really neat idea would be to take the OpenAPI (aka swagger) spec, and produce a "coverage report", i.e., show how many of the API endpoints in the API were successfully tested/hit by tavern. What do you think of this idea?