How to Introduce API Testing

QASource
QASource | March 7, 2018

How to Introduce API TestingOrganizations are increasingly using application programming interfaces (APIs) to connect their products to the outside world. Whenever you sign up for a new service and it pulls your information from Google or Facebook, or you launch a data-consuming app on your smartphone, there’s an API at work. APIs are essential for creating a simple, streamlined, and increasingly connected experience for customers and companies are finally beginning to realize their value - and to direct more resources toward their development and maintenance.

But an API is useless if it doesn’t work effectively and efficiently. Without proper testing, an API can cause problems for an application and its user, as well as the entire chain of processes connected to it (Click to tweet). As a result, organizations are becoming more vigilant about API testing to:

  • Make sure the API does what it’s supposed to do
  • Ensure that it can handle the load it’s designed to handle
  • Find all of the different ways that a user can break the API
  • Test that the API works across all intended devices, browsers, and operating systems

Now that we’re familiar with APIs and why we test them, let’s have a look at the checklist for introducing API testing:

Set up your dream team

Ideally, your testing team already has knowledge of API architecture. If not, you’ll want to consider working with a qualified testing partner. Otherwise, you’ll need to invest in training your existing onsite team.

It’s great if your team also has the following:

  • Understanding of API tools for functional testing
  • Knowledge of request and response formats like JSON, XML, etc.
  • Knowledge of automation tools like ReadyAPI, Postman, UFT, etc.
  • Basic programming skills for API test automation
  • Advanced programming skills for developing API frameworks

Set up your environment

This step can be broken down into three sub-steps. First, you’ll need to configure your database and server parameters to set up your test environment. Next, make a test API call to ensure you get a valid response and ensure that nothing is broken. Finally, define your test data per the required set of input and output parameters.

Define your test plan

Of course, your test plan will vary based on your product and API. But generally, a solid test plan should 1) cover all of the positive and negative test scenarios, 2) define the priority of API scenarios, and 3) include unit, integration, security, performance, and third-party API tests.

Select your tools

Your manual testing tool should be:

  • Intuitive and easy to learn
  • Able to manage test cases and test suites
  • Able to manage execution and reporting
  • Able to do basic automation

And once you have completed functional testing of your APIs, the next step is to automate these tests. This helps your QA team run them periodically as part of every build, with no manual intervention. Your automated testing tool should:

  • Support your API architecture
  • Be intuitive and easy to learn, just like your manual testing tool(s)
  • Integrate with your CI tool
  • Offer good reporting capabilities
  • Scale to support different forms of testing, such as performance, security, etc.

Looking for more information about selecting a tool? Read our blog post, 6 Things to Consider When Choosing a Test Automation Tool.

Design and develop your framework

Frameworks should make your life (or your team’s lives) easier. They automatically drive the test’s execution, define the basic outline and structure, set guidelines and structures, and track execution results. Ideally, a framework should make it easier to develop and execute API tests and publish reports for stakeholders.

It should be designed with the following best practices in mind:

  • Reusability
  • Scalability
  • Coding conventions and standards
  • Robustness
  • Modularity
  • Maintainability

Integrate with CI

Your next step is to integrate the framework with your CI tool. This will give you benefits like scheduling, advanced reporting, results comparison with previous builds, automation stability, and the ability to understand build health.

Execute and report

Execute your automated API tests on your defined environment, then generate and publish reports for stakeholder review.

Maintain and monitor

With everything in place, your team can schedule out tests and continue to focus on the robustness of the framework, fix any failures, and keep all of your API tests up to date.

Want to learn more about implementing API testing?

Click the button below to download the free checklist "10 Steps to Start API Testing"

 

Disclaimer

This publication is for informational purposes only, and nothing contained in it should be considered legal advice. We expressly disclaim any warranty or responsibility for damages arising out of this information and encourage you to consult with legal counsel regarding your specific needs. We do not undertake any duty to update previously posted materials.