4

We want to add formal testing an quality assurance to our application API. It is written in Python using Flask with Restless and outputs JSON.

My question is what is the best way to test our API? It is relatively small, has about 40 endpoints most of which have GET, POST, PUT and DELETE request methods. Is it worth writing unit tests for every endpoint + request method combination?

Ideally we would like to do continuous integration testing with something like Jenkins.

1

For automatically testing an API in a CI/CD scenario, try Runscope. It integrates with several build/deploy tools, including Jenkins (see Jenkins integration instructions here). In fact, I just put out a Jenkins plugin for Runscope that makes it super simple -- API tests are just build steps. You'll find GitHub link to plugin on second link above.

You can run tests against endpoints in the cloud, in a private staging environment (VPC, behind firewall, etc.) or even on your localhost.

Runscope is an API testing and monitoring solution. You can build simple multi-step tests in minutes without any coding required; however, you're also able to code assertions using JavaScript (Chai assertion library). To execute a test, you can trigger it remotely with an HTTP call, or if you're monitoring production, you can use those same tests which execute on a scheduled interval (as often as once per minute).

Disclosure: I work at Runscope.

0

For manually testing an API, I like Postman. It's a Chrome app so it won't tie into Jenkins as far as I know.

API testing is pretty simple, though. You could write a simple framework that makes use of a Http Client that hits all your end points and performs assertions on the JSON responses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.