QA testing helps to ensure a quality product, but it also impacts a company’s bottom line. Issues found late in the development cycle, or even on production, can require much more engineering time, resources, and costs than expected. Added time spent creating tests following development can push back release dates or cause QA to simplify tests in order to save time. Gear4music the U.K.’s largest online retailer for musical equipment, has integrated QA testing throughout the cycle to help improve code quality and organizational efficiency. Its team of six QA testers rely on Postman to help them write, run, and automate tests in one unified workspace, so they can deliver results at scale.
Introducing the concept of early API testing
Prior to building up a QA team, the Gear4music engineering team followed a predominantly developer-driven testing process for APIs. Testing usually happened towards the end of a project, when the frontend work had already been completed. However, some aspects of an API may not be exposed to the front end. This increased the possibility that errors would not be discovered until late in the project, which could in turn delay shipping.
Towards the end of 2018, as part of the QA team expansion, Gear4music hired a QA lead with extensive experience testing APIs. Paul Farrell wanted to bring early testing to the organization and make it an integral part of the development workflow. Early testing could be as simple as asking the right questions at the right time, such as how developers are writing schemas or response bodies, or spotting inconsistencies in UI design.
However, Paul envisioned a more robust approach. His experience with Postman in previous jobs, as well as his deep involvement with the Postman community, enabled Paul to develop a comprehensive testing strategy that helps Gear4Music ship better quality code, faster.
Setting up tests in advance on Postman
During a development sprint, the Gear4music engineering team determines the JSON schema and responses as part of their development framework. Using Postman, the QA team can then start writing API tests in parallel with development. Testers use the same response bodies and JSON schemas with Postman Mock Servers , which enable the team to simulate the expected behavior of the API even while still in development. Using mock servers can help QA prepare a full test suitein advance. When developers submit a “Ready for QA” ticket, the testers are ready to go. Instead of just starting their test buildout at that point, they simply switch the environment in Postman from “mock” to “dev” and immediately start executing their test run. Such advance test preparation helps the whole project team stay productive throughout the sprint and allows a more robust group of tests to be built.
It’s super helpful to be able to set up tests early in Postman. As soon as the code is ready, we’re ready.
Collection variables streamline testing
When testing API requests, the QA team needs to repeat the same information in each request. Rather than copy/pasting JSON schemas into every single request, the team uses collection variables in Postman. Variables allow the team to store and reuse data throughout the requests in a collection. With this approach, the team puts all the response bodies used in a collection at the top level and then assigns them to environment variables so they can easily call them whenever they want. JSON schemas go into the “Edit Collection” section of the “Pre-Request Script” tab. Everything lives in one place, which makes them much easier to maintain and helps the tester work more efficiently.
Using variables in Postman helps me avoid the pain of having to duplicate data across all our requests. Instead, I can spend that time doing more valuable tasks.
Scenario testing in a Postman Workspace
Many of Gear4music’s test suites are built around end-to-end API scenario testing, which translates a particular workflow into a series of requests. When Paul joined the company, one of his first projects was to create a test suite for the Returns API. The business wanted to improve the returns process for both customers and customer service staff. This involved a complex workflow that addressed a number of use cases for the API. Scenario testing needed to check each step of the returns processing flow and make sure that data was consistent and persistent.
Postman’s platform, with scalable Workspaces and Collections, enabled Paul to map the core functionality of the returns workflow into a series of Collection sub-folders that included individual tests and relevant API endpoints. One folder contains tests associated with the customer’s reason for the return and database updates. Another contains all the tests related to the unique reference number for the return. Other folders address supplier returns, advanced replacements, and more scenarios. Whenever a developer creates a new environment with a code update, the team runs through all the tests and the results are logged in Jira.
Postman’s ease of use allowed me to jump straight into an API project as soon as I started at the company.
A scalable testing hub on Postman
All together, the QA team’s Returns API test suite includes 196 requests — a significant number for any team to track and maintain. Without Postman, they would have had to manually copy/paste data to every single request whenever updates were needed. With Postman as the hub for the QA team, Gear4music has been able to effectively integrate API testing throughout each project, resulting in faster development cycles and higher productivity across teams.