At ProtoTest, we often recommend that our clients implement a suite of automated functional API tests. And yet, many people struggle to understand how truly valuable API tests are.
Since they don’t test something directly user-facing, clients don’t want to prioritize them over creating UI tests. And because the UI tests are never finished, the API tests are never even started.
Yet if you analyze the return on investment, API automation can save the organization a significant amount of money, because the API is the backbone of the entire application stack. It is the interface that all the pieces use to communicate with each other. It’s a contract, stating exactly how each piece of the application has to work. As such, it’s the glue that holds everything together.
What tends to happen is that there are multiple client applications, such as a mobile app and a website, that both use the same services layer. In order to support a new feature on one client, the services are modified in a way that the other client doesn’t expect. This causes the other client to break, even though the release had nothing to do with it. The only way to catch this type of error is to test both clients, which costs a lot of time and money.
The API layer usually sits on top of the back end of the application stack. In a web site, it would be a series of REST services that can read and write to the database, and execute code on the server. These services are usually shared across multiple front end applications. So once it’s functionally tested we can assume that the back-end system is fully operational. This allows us to test and release it completely separately from the UI, which has a dramatic and immediate effect of reducing the cost of making changes to the back end code.
API tests allow you to test components in isolation, reducing the number of test cases each release exponentially. And since API tests run almost instantaneously, and without any human interaction, even if a defect does make it into production, it’s extremely cheap and easy to test and release a fix.
A suite of functional API tests puts the organization in a position where you can release quickly, cheaply, and independently. These are the true goals of any effective testing organization, and this is why they are one of our first recommendations.
Interested in learning how to implement a suite of automated API tests? Contact me to learn more.