The Lazy Dev's Guide to Testing Your Web API
Do you enjoy writing test cases for your web application? If so then this may not be the talk for you. I'm going to show you how to make a single test suite perform triple testing duty, so you can get on with writing the fun stuff.
First, I'll show you how to use WebTest to construct a simple functional testsuite for your application. By running in-process against a WSGI callable, the tests can be fast and light enough to form part of your regularly-executed suite.
Second, we'll use WSGIProxy to turn this into a deployment/acceptance test script that you can point at a real live server to verify its behaviour. Run this after every deployment to make sure you haven't broken something in the wild.
Finally, we'll connect the suite to FunkLoad and pummel the server with a distributed barrage of tests, to see how it copes under pressure.
Ryan is a software developer who lives near Melbourne, Australia. He has been programming in Python for nine years and despite frequent sojourns into other languages, he has always returned to Python for its unique combination of expressiveness, readability and strong sense of community.
After trying his hand at contract development work, a small cloud-storage startup, and even some dabbling in academia, he now builds high-performance Web APIs for the Mozilla Services team.