jeudi 19 avril 2018

Is endpoint unit testing possible based on only OpenAPI 3.0 file?

After some googling I decided to directly ask this:

Is it possible to run REST API endpoint "build tests" based on solely an OpenAPI 3.0 specification file?

I would like to add example request-response pairs to the OpenAPI spec file and have either an existing or self-written library run through all the such defined tests and report any failures.

As far as I understand the standard, it would be easily possible to include examples for requests and test the response in a schematic way (thinking http://json-schema.org/). But I don't yet see a way to incorporate more specific tests, such as testing a number in a specific response field to be an exact value. Also, it would be nice to have a way to sequentially test requests, but I don't expect to achieve that just from the spec file.

An optimal solution would be included in my repository and run the tests on localhost. Thank you all very much in advance.

Aucun commentaire:

Enregistrer un commentaire