A constant flow of information forms the basis of modern society. In a world of continuous integration and development, every device with an Internet connection is bound to share or request information from a server hundreds of miles away. Thriftly makes you an API owner, and as an API owner, it’s crucial that you actively monitor your API as it communicates with other applications. That way, you can respond to any degradation immediately, before it impacts your customers' ability to exchange information.
An unexpected input could come from anywhere, as your API is consumed by desktop apps, mobile apps, web apps, embedded systems, or even other servers. Because there are so many places an unexpected error could occur, it's better to proactively monitor and test your API than to react to issues as they arise. You can, and should, implement automated API testing, in both your development and production environment.
You can automate several types of tests to ensure your API is performing as it should, including tests for:
- Availability: Is your API running and returning a correct status code?
- Data Validation: Is your API returning the correct data?
- Load Testing: Can your API easily handle simultaneous calls from multiple users?
- Response Time: Is your API slow to respond to requests?
- Security Testing: Can an unauthorized user access a secured call?
- User Testing: Have you tested various weird inputs and edge cases? Because your users will.
The Thriftly demo application is connected to different endpoints hosted across our globally distributed servers. So we also need to perform automated API testing, to ensure our own APIs are always running and to receive notification of any issues that arise.
One of the resources we use to perform this testing is StatusCake. StatusCake supports many of the tests we talked about above and sends automated email alerts if a test fails for one reason or another. You can also set how often StatusCake should run tests (every day, every hour, etc.) to check your API's reliability. We'll get into some of the specifics about how we use StatusCake (and other API testing tools, including our own Thriftly API tester) in the future, but in the meantime, we encourage you to mess around with it yourself.
The best part of implementing automated tests is that once you create your initial testing framework, you can easily apply it to all your APIs, present, past, and future. Just plug the API into your testing framework, and you can rest easy knowing that your code is covered, allowing you to focus on further developing your APIs and your business.
Get started creating easily testable, maintainable APIs from your existing code with Thriftly. Click below to sign up for our free trial and see what we have to offer.