I've been really interested in this problem for a while now, and your assumption is correct that it's definitely possible. We've been working on solving this at Assertible <https://assertible.com>, and a couple of the harder parts we've hit are:
Route parameters and other variables. Required "setup" for PUT/DELETE/etc requests. Setting up auth. In a lot of cases there just *has* to be some additional configuration. That said, we've built what I this is a very good starting point to automatically generate a test suite from a Swagger spec. We put together a post on Testing an API using Swagger <https://assertible.com/blog/testing-an-api-using-swagger>. Basically, when you import a Swagger spec, a test is generated for each unique endpoint/method combination (like *GET* /users and *POST* /users). Route parameters are automatically filled in as "*variables*" and auth is stubbed out from the "*securityDefinitions*" found in the swagger spec. The actual tests/validations are done by creating "*assertions*" that are created for the expected status code response. For example, importing the Twitter Swagger spec would give you something like this: <https://lh3.googleusercontent.com/-oIsCAXZYBAw/WRD6ZB5aRII/AAAAAAAAAU8/WwTJhE9fsuESsNPdWjhaz3Bl7UI5zq0kQCLcB/s1600/assertible-twitter-swagger-import.png> What are your (or anyone elses) thoughts on this approach? We've got a lot of plans/ideas for how we can dynamically generate even more tests and assertions from a Swagger spec. The idea is that, you simply have to import your spec once, and you're set up with automated tests, monitoring, failure alerts, etc, right out of the box. Let me know what you think - I'm really interested in others people's thoughts about testing from a spec! - Cody Reichert [email protected] https://assertible.com On Friday, August 16, 2013 at 6:38:35 AM UTC-5, chrokh wrote: > > I'm new to Swagger but I believe I'm getting a clearer picture of the > eco-system, and it looks fantastic. > > However, I'm wondering whether there's a module that allows me to run > automated tests against my actual API to see whether it conforms with my > Swagger spec. *Without* server integration. > > Assuming you have a Swagger spec-file and a running API it sounds > reasonable to me that this should be possible? Basically, black-box > testing. Is there something like this? > > Thanks in advance! > -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
