Rigorous API testing must overcome massive complexity, reckoning with a vast number of possible test cases. The message data needed to reach endpoints must “cover” every distinct data combination of values. That includes data values entered by users, as well as the unique actions they perform against a system. It also includes machine data generated by user activity, for instance content-type and session IDs.
API tests must also account for the journeys through which the data can flow through the APIs. They must cover the combinations of API actions and methods that can transform data on its way to reach certain endpoints.
But APIs don’t exist in isolation. They, by definition, connect multiple systems or components, so every test is therefore end-to-end test in some sense. A rigorous set of API tests must therefore account for the vast number of combined actions or methods that can transform data as it flows through connected-up APIs.
An unrealistically simplified example would include 1000 combinations of user inputted data, 1000 different combinations of machine generated data, and 1000 distinct journeys through the combined actions:
That’s already 1 billion combinations, each of which is a candidate for an API test. Rigorous API testing must therefore select a number of test cases that can be executed in-sprint, while still retaining sufficient API test coverage.
Unfortunately, the testing techniques used in API testing are often too manual and unsystematic for rigorous API testing. Business-critical APIs risk being under-tested at each point of the testing lifecycle:
Testing complex chains of APIs instead requires an integrated and automated approach. API testers must be able to identify the smallest set of API tests needed for API testing rigour, systematically creating the test data and environments needed to execute them.
To overcome the complexity of API call chains, teams can benefit from a model-based approach to API testing, in which testers can generate everything needed for rigorous API testing from easy-to-use models.
Here’s how it works:
With this integrated approach, QA teams can themselves generate everything needed for rigorous API testing. Maintaining central flowcharts keeps the tests, data and virtual services aligned, testing complex chains of APIs within short iterations.
Download the latest Curiosity-Parasoft eBook to discover how this approach can maximise the speed and rigour of your API testing.
Tom Pryce is a technologically hands-on Communication Manager with Curiosity Software Ireland. His interests include Model-Based Testing, test data management, and Robotic Process Automation. He tweets under @Curiositysoft.