API Automation With JavaScript

Julia Pottinger's profile
Julia Pottinger

Head of Training and Development at QualityWorks

Challenge Description

Select the things you would include in your automated tests for a specific API and then select one of those tests to write an automated script for using supertest. As an example you could use the following API - https://restful-booker.herokuapp.com/apidoc/index.html

Instructions:

Part 1 - 10 mins

Using the API above and the guide on ‘how to decide which tests you should be automating for your API’ that was shared in the Next Level API Automation talk, create a list of scenarios that:

  1. Would be included in your API automation 

  2. Would not be included in your API automation and why

Part 2 - 15 mins

  1. Clone the repo that was used in the API automation workshop https://github.com/jpott77/api-automation-supertest

Select one of the tests that you would include in your API automation and write the code to automate it

Demo - 5 mins

  • Share what you would include or not include in your API automation and why

  • Share the automated test you wrote for the API

Wrap-up:

API automation as with all other test automation requires some thought and planning to ensure that you reap the intended rewards. API automation is valuable because it can speed up tests, help test at an earlier phase in the SDLC without the need for GUI’s and increase the scope of tests as API-level tests are specifically designed to verify all system components function as intended.

This activity should have allowed you to think about why you automate specific scenarios over others as well as give you practice with writing automation scripts.

What you’ll learn
  • Automate API’s in Javascript using Supertest
  • Decide what API’s to automate
  • Discuss the API Testing Checklist

Prerequisites

Resources

Strategies to Make Your Automated Checks Reliable and Robust
The Joy of Record and Playback in Test Automation - Louise Gibbs
Leading a Test Automation Strategy
Low Code Test Creation
How to turn a 403 into a 202 at the API Party
Constructing an API Testing Framework - Joep Schuurkes
With a combination of SAST, SCA, and QA, we help developers identify vulnerabilities in applications and remediate them rapidly. Get your free trial today!
Explore MoT
TestBash Brighton 2024
Thu, 12 Sep 2024, 9:00 AM
We’re shaking things up and bringing TestBash back to Brighton on September 12th and 13th, 2024.
MoT Intermediate Certificate in Test Automation
Elevate to senior test automation roles with mastery in automated checks, insightful reporting, and framework maintenance