Exercise 1:
Using https://automationintesting.online created by Mark Winteringham and myself, do the following:
- Do a GET call against https://automationintesting.online/room/, you should get rooms returned
- Assert on the correct status code and that the body has a room object.
- Get a token by doing a POST against the auth API at https://automationintesting.online/auth/login endpoint. You’ll need to send the following JSON in order to get a token back.
{ "username": "admin", "password": "password" }
Share
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.
Kết quả
Exercise 2:
Using https://automationintesting.online created by Mark Winteringham and myself, do the following:
- Get a token by doing a POST against the auth API at https://automationintesting.online/auth/login endpoint. You’ll need to send the following JSON in order to get a token back.
{ "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
- Do a POST call against the booking API to make a booking for the room, https://automationintesting.online/booking/. The JSON should look like this, changing the data as you like and ensuring you map to the roomid you stored earlier.
- You’ll also need to send your token as a cookie.
{ "bookingdates": { "checkin": "2018-11-01T09:48:25.469Z", "checkout": "2018-11-01T09:48:25.469Z" }, "depositpaid":true, "firstname": "string", "lastname": "string", "roomid": <<roomid>>, "totalprice": 0 }
Share
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.
Yep one {...} is used to define a single object, while the other [...] is used to define a sequence of either objects, values or lists ...
objects are defined as such {key:object or list or value , ...} list ares nothing more than a sequence of either objects or lists or values, [objects or list or values, ... ]...
[{'value':1}, {'values':[1,2,3,3, {'a':'a', 'b':'b'}]}, 2, 3, 4]
Kết quả
Objectives
- Loop through a dataset calling an API each time
- Gain exposure to many some API testing automation frameworks or tools that support API automation.
Example
Using https://automationintesting.online created by Mark Winteringham and myself, do the following:
- Do a GET call against https://automationintesting.online/room/ , you should get 1-N rooms returned. Assert on the correct status code and that the body has a room object.
- Get a token by doing a POST against the auth API at https://automationintesting.online/auth/login endpoint. You’ll need to send the following JSON in order to get a token back.
{ "username": "admin", "password": "password" }
- Extract the token and store it
- Do a GET call against https://automationintesting.online/room/ 24, 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 }
- Loop through all your data doing a POST call against the booking API to make a booking for the room, https://automationintesting.online/booking/
- Get a token then save to request headers
- Add more rooms for booking management system
- Get a list of room ids
- Make a booking for each room then verify info
- 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:
