DEV Community

Discussion on: Testing an API Against its Documentation

 
honzajavorek profile image
Honza Javorek

The API description document (API Blueprint, Swagger, OpenAPI) usually describes the API in form of some expected happy scenarios. Usually, it doesn't contain examples for all the corner cases. In this sense, it is something like README for a software project. It helps user to understand how to use the API, but it doesn't replace the reference book. For that reason, if you test your API against your API description by Dredd, you get very very very useful thing - an assurance that what users read in the docs is exactly how the API works. But you don't get all the negative scenarios and all the corner cases, so you still need to add some unit/integration tests. That's why I think this is more of a RDD than DDD, but anyway, this is pretty much bike shedding :D

I had a talk on this topic on PyCon SK, maybe I'm clearer in expressing my thoughs there - youtube.com/watch?v=mGUul6NbYw4&li...

I completely agree an actual README should not be equal to an API description.

And by the way, thanks for a great article. We should definitely link it from the Dredd docs! It's better than our own tutorials. It's amazing to see when people find Dredd so useful they even write articles about it.

Thread Thread
 
albertofdzm profile image
Alberto Fernandez Medina

Thank you very much!

Haha, I didn't know you were one of the main contributors to Dredd! Thanks a lot for work on tools like this!

I saw part of the presentation, I didn't know such tools like doctests exists! This is amazing.

Thanks for your comments and contributions.