Modern testing for modern stacks

API automation: DIY guides

For testers, API automation offers a sweet spot between unit testing and GUI automation. These days, most web applications have RESTful interfaces - lending themselves nicely to API automation. At Qxf2, we use the API automation to perform a lot of the test setup activities. API automation is fast, robust and much easier to maintain than GUI automation. Here is a list of tutorials for you to implement API automation at your company.

1. USING DEVELOPER TOOLS LIKE A PRO Beginner
Learn to use developer tools like a pro! Inspect the API calls being made by your applications over the network. This post forms the basis for writing more complex API tests.

2. GUI BASED TOOLS FOR API TESTING Beginner
An overiview of GUI based tools you can use for API testing. We explore the popular Postman REST client in depth.

3. WRITING API TESTS USING MECHANIZE AND PYTHON Intermediate
We use a Python module called Mechanize to write robust API tests. Mechanize is like a browser that will do header and cookie management for you. Mechanize can get past most authentication servers - which makes it easy for you to get started with API testing. But it cannot render JavaScript like a real browser can - so its very lightweight. This makes it an ideal tool to use for API testing especially when your APIs are not very clean.

4. PYTHON MECHANIZE: AN ADVANCED TUTORIAL Advanced
For all the great things Mechanize does well, it does have some glaring holes. Like no out of the box support for PUT, DELETE, PATCH methods. So we dug into the source code and figured out how to fill out these holes. And we shared our solution on Stack Overflow and in this post.

5. AN INTRODUCTION TO RUNSCOPE FOR API TESTING Beginner
Runscope is a powerful tool to help you quickly get started with API testing. Runscope has a user friendly web interface. It also allows you to perform advanced variable manipulations and complex assertions in your tests via scripts. You can also schedule tests to run regularly and receive notifications. When it comes to API testing, Runscope makes the easy things easy and the hard things possible.

6. CAS AUTOMATED LOGIN USING PYTHON MECHANIZE Advanced
One of the hard things about using APIs as part of automation is to figure out how to login to the applications. CAS is one of the best known and hardest to crack authentication servers. We have written up a tutorial on how to login to a CAS server using Python and Mechanize.

paper cut