30 Days of API Testing Day 30: Complete Exercise 4

(Richard) #1

Welcome to exercise four, for day thirty of 30 days of API Testing.


Loop through a dataset calling an API to create an entity each time using some tools with automated execution capabilities or in code using an API testing framework.


  1. Loop through a dataset calling an API each time
  2. Gain exposure to many some API testing automation frameworks or tools that support API automation.


Choose an API testing automation framework or tool, some suggestions below:

Create a dataset appropriate for that API and loop through it making the API call each time. Many test APIs have been posted for challenge 5. Try treating them as separate tests and adding an assertion after each one. Bonus challenge: add some bad data in there and assert the API rejects it.


Using https://automationintesting.online created by Mark Winteringham and myself, do the following:

	"username": "admin",
	"password": "password"
  • Extract the token and store it
  • Do a GET call against https://automationintesting.online/room/, you should get 1-N rooms returned. Extract a room ID from one of the rooms
  • Create test data like below, perhaps parameterise the name and date fields
  "bookingdates": {
    "checkin": "2018-11-01T09:48:25.469Z",
    "checkout": "2018-11-01T09:48:25.469Z"
  "depositpaid": true,
  "firstname": "<<paramterised data>>",
  "lastname": "string",
  "roomid": "<<roomid>>",
  "totalprice": 0


Post your experiences with the tools you use below.
If you used a different API post the calls you did so others can try them.

(Duong) #2

I completed this exercise using data driven feature of Katalon Studio

(Conor) #3

I used python requests.
Test API was https://jsonplaceholder.typicode.com/posts
Available her https://jsonplaceholder.typicode.com/

Decided to send json data to the API.
Json data:

Sample Python Requests Code

(Heather) #4

API Fortress have a video that might help some folks navigate this challenge using their tool

(Tu Anh Nguyen - KMS) #5

I continued using my own framework to complete the last practical one (Exercise 4).
I used a loop to add five rooms more to the system and made bookings to all rooms. I called randomString function to generate firstname and lastname for each booking.

Below is my steps:

  1. Get a token then save to request headers
  2. Add more rooms for booking management system
  3. Get a list of room ids
  4. Make a booking for each room then verify info

(Trang Ta) #6

Using Katalon, my exercise 4 is:

  1. Create file booking data .xlsx
  2. In Katalon project > Data Files > new Test Data type Excel file
  3. At Profiles > default > Add Global Variables
    4.At Object Repository > New Web service request : BookingRoomDataSet to https://automationintesting.online/booking/ with information get from global variables
  4. At Test Case > New Test Case : exercise4
  • Send request to login to get token (as exercise 3)
  • Setting value to global variables
  • Send request to BookingRoomDataSet
  • Verify results
  1. At Test Suites > New Test Suite : Exercise 4
  • Add test case Exercise 4
  • Click Show Data Binding
  • At Test Data > add data from data file in step 2
  • Setting Variable Binding
  1. Run test suite

(Tuan Tran) #7

I using the Postman for Ex4. I did update the my Exercise 3 to complete this exercise.

Here is my work:

  • Create the bookingdata.csv file for the data

  • Update the body of request to booking to using the data from file instead using the hard-code data.

  • Running the collection with the data file:
    Note: To make sure the data is correct, using the Preview button

  • Here is the result:

P/s: The code on Katalon for this exercise is so cool. I challenge myself do this exercise again on Katalon :smiley_cat:

(KMS Nam Nguyen) #8

I completed this exercise with Katalon tool
Here is my work:

  1. Create data data file .csv
  2. Create method GET Room
  3. Create method POST - Get a token
  4. Create method POST to booking room with JSON data
  5. Create method POST to booking room with data driven
  • image
  • image
  1. Create Test Collection execute all test suites
    The Katalon can make it easy :wink:

(Thanh) #9

I used Katalon to complete this exercise as below:

(Thao) #10

I’ve completed this exercise using Katalon:



(Felipe) #11

For this exercise I also used API Fortress and the Shady Meadows Booking API

This is the dataset I used:


I loop through the first 5 elements in the array and make bookings based on the values for each record. Each iteration also includes an assertion for a 200 response. The last record is a dupe and since it has a date range that is already booked, the request will fail. I made a separate request and assertion using that specific record

Test Script

Online Report

Shady Meadows UI