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:
-
Would be included in your API automation
-
Would not be included in your API automation and why
Part 2 - 15 mins
-
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
API Documentation - https://restful-booker.herokuapp.com/apidoc/index.html
Resources
-
Testing Web API’s - Mark Winteringham - https://bit.ly/mot-apis
-
How to test APIs with Supertest - https://bit.ly/mot-talp
- Security Testing of APIs Checklist - https://bit.ly/mot-psta