You Don’t Need Coding For APIs Testing
“Let me code the API tests”.
That sounds right, someone wants to help build an API test suite. Why not?
You should get back to the initial objective: accelerate the delivery of valuable software with confidence for the team.
They don’t need more code. They need fast feedback to decide whether or not to proceed with their software changes in production.
Your goal is to implement reliable and maintainable tests ensuring requirements are met, supporting your team.
This article shares how you can focus on API testing.
Follow Cerberus Testing for more open-source test automation.
Understand the API 3W: Why, Who and What
You can align API testing efforts by understanding why and for whom they were designed in the first place. Only then, look at the what.
Generically, APIs is a technical way to:
- Access to information (get an object, a list);
- Update information (store, update or delete);
- Ask for an action.
You have to understand:
- Who will use the API?
- Which functions do they need?
- What data do they interact with?
From there, you can already test the API description assessing its clarity in regards to the identified needs.
You can look at the structure, objects, verbs asking “If I was one of the users, do I directly understand what to use?”
Once the APIs are correctly described, you can build your API collection.
Build the API collection to have the big picture
An API test repository lets you reference the APIs like your users would, independently from their implementation.
An intuitive approach would be to create a folder per API, progressively adding tests inside.
The problem: you will be technically driven by the API structure, forgetting about the users and their needs.
Structuring your API collection on the personas aligns your tests to their needs.
You can for example reach a structure like this one:
- User persona 01: User experience developer, start-up to SME
- Test case 001: Create a developer test account
- Test case 002: Retrieve the product sample catalog
- User persona 03: Integration developer for ordering system, all sizes
- Test case 001: Create a system API account
- Test case 002: Retrieve a temporary application token
- Test case 003: Place a new order of typology A
This lets you focus on the value to deliver, avoiding the traps of focus on the implementation or only testing edge cases.
Focus at ensuring main use-cases are met
Your team is waiting for your tests to increase the stability and confidence of their software changes.
Quickly providing tests as part of the delivery process is your objective.
You must focus on providing value as soon as possible, leaving in the backlog nice-to-have improvements.
Here are the steps to follow in short cycles:
- Identify with the product team most valuable use-cases;
- Deliver the first automated tests on the priorities;
- Make sure the tests are usable and used in the processes.
Always keep that focus on value for the team, knowing to stop when an equilibrium is reached.
You can then add a few tests on specific API requirements.
Look at the boundaries to detect leaks
Your team will not mention specific API testing requirements because this is not their job or focus.
You therefore have to proactively work on specific areas such as:
- Security testing for authentication and authorization mechanisms;
- Test how the API behave with unexpected values;
- Verify user journeys exceptions are managed.
Again, there’s no need for testing all cases – focus first on the minimal ones for main cases and key questions:
- Verify access to resources is only possible with authentication and roles;
- Verify the API remains stable even with strange and exceptional values;
- Verify that if go back in the workflow, APIs answers remain clear.
From there, your job is to keep your API tests valuable.
Ensure the tests remain valuable to the team
Your team will find value in your tests if they help them deliver faster and with more confidence.
It means that the following points are essential over time:
- Test alignment with use-cases and requirements;
- Stable and fast execution of test suites;
- Simple integration and reporting.
A failure to maintain these requirements will lead to a progressive abandonment of your tests, leaving all your effort vain.
You therefore have to continuously interact with your team to ask feedback and measure their usefulness.
That’s another reason you should not be coding.
Stop coding and start testing to win
Testing is a critical activity to accelerate the delivery of valuable software.
The competition faced by companies requires them to continuously adapt their value proposition with software changes.
All the time not directed to accelerate software delivery can mean losses of opportunities for your company.
Cerberus Testing provides you a unified test automation platform on a web interface for web, mobile, desktop, database & APIs testing (SOAP, GraphQL, REST APIs).
Leveraging an open-source test automation framework allows you to focus on creating value through your testing.
Stop coding and start testing.