Assignment: Writing API Tests with Postman
Objective:
In this assignment, you will use Postman to test the “Booking – GetBookingIds” API from the Restful-Booker API documentation. You will create three tests to retrieve booking IDs with various filtering options.
Your Role:
Pre-work Step: Set up Postman
Step 1: Access API Documentation
Step 3: Create Test 1 – Retrieve all IDs
- Select the HTTP request type as “GET.”
- Copy the API endpoint URL provided in the API documentation.
- Send the API request and observe the response to ensure you retrieve all booking IDs.
- Take a screenshot of the results.
- Make sure the complete Postman application and the body of the response are visible.
- Since the API is accessible to anyone, it would be hard to know how many bookings there should be or if any entries are corrupt or duplicates. How would you consider validating it? One simple way is by checking the status. If you see a 200 OK status, it’s possible to assume it has returned all the bookings.
Step 4: Create Test 2 – Retrieve IDs with filtered first name
- Using the same endpoint, create a test to retrieve IDs with the first name filtered to “Sally.”
- You can set parameters using the URL or the Postman Params tab.
- Take a screenshot of the results.
- Make sure the complete Postman application and the body of the response are visible.
- Validate the booking (or one of the booking results) has the first name value of Sally by using the GetBooking endpoint.
- Take a screenshot of the results of this as well.
Step 5: Create Test 3 – Retrieve IDs with check-in and check-out date
- Using the same endpoint, create a test to retrieve IDs with a check-in and check-out date of your choice. Try to use a wide range to ensure you get results.
- You can set parameters using the URL or the Params tab in Postman.
- Take a screenshot of the results.
- Make sure the complete Postman application and the body of the response are visible.
- Validate the booking (or one of the booking results) with the check-in and check-out date of your choice using the GetBooking endpoint.
- Take a screenshot of the results of this as well.
Step 6: Review and upload the Results
- Analyze the responses from each test to verify if the API is returning the expected results based on the parameters provided.
Submission:
You should now have 4 screenshots of the API test results. Save them into one document or PDF, and upload them in the space below.