It would be nice to have documentation / and / or examples of what are good workflows for testing a connexion app's API.
Yes, I would love that too!
As I am currently facing testing of a connexion api myself, here is a quick overview of my "setup" so far.
Feedback greatly appreciated, would love to add to the docs.
Using e.g. Tox or similar to provide a virtual env, test your units (functions) by mocking everything needed.
Test the respective function calls/routes individually. Mock database etc.
Test everything in conjunction. Populate your API models with fake/dummy data and cross-test every resource.
The Unit Test part most definitely needs to be done completely by hand, but for step 2 Dredd by @apiaryio looks very promising.
If I get it right, you can simply add some example values to your swagger/openAPI specification and some hooks and Dredd will automatically validate your routes.
E2E-testing probably needs to be done by hand again.
What do you guys do? What do you think of my testing approach? Where can it be improved?
I really don't like the 'need to write everything by hand' approach as swagger provides such a nice overview of all routes, that should be leveraged.
Edit: Also, swagger-tester looks promising.
@FWirtz I like your approach on testing. Sounds reasonable to me. It is similar to what I try to do in the projects I work on.
I'm yet to try Dredd and swagger-tester. Looks interesting.
Most helpful comment
Yes, I would love that too!
As I am currently facing testing of a connexion api myself, here is a quick overview of my "setup" so far.
Feedback greatly appreciated, would love to add to the docs.
1. Unit Tests
Using e.g. Tox or similar to provide a virtual env, test your units (functions) by mocking everything needed.
2. Integration Tests
Test the respective function calls/routes individually. Mock database etc.
3. End to End Tests
Test everything in conjunction. Populate your API models with fake/dummy data and cross-test every resource.
The Unit Test part most definitely needs to be done completely by hand, but for step 2 Dredd by @apiaryio looks very promising.
Dredd
If I get it right, you can simply add some example values to your swagger/openAPI specification and some hooks and Dredd will automatically validate your routes.
E2E-testing probably needs to be done by hand again.
What do you guys do? What do you think of my testing approach? Where can it be improved?
I really don't like the 'need to write everything by hand' approach as swagger provides such a nice overview of all routes, that should be leveraged.
Edit: Also, swagger-tester looks promising.