Skip to content

Feature File: Response Content

Mahmoud A. Zaid edited this page Mar 15, 2019 · 3 revisions

After what we have done in the previous lesson by testing the GET response status code we will explain how we could compare the response content to make sure the API response with the correct data, you can find the final feature file here

the main idea in this lesson and the next one is to learn how we deserialize the API response, create the instance from SpecFlow table.

  1. Create a new feature file and write your test steps as below
Feature: GetSingleEmployeeContent
	This page will contains information about, how to access particular employee data using rest api /employee.


@api
Scenario: Check Get Single employee Content
Given Create Request "employee/{id}" with "GET" method
When Create URL segment for "id" with parameter "8126"
And Execute API
And Deserialize the employee api content
Then The employee should have the following values
|Key		  |Value	 |
| id              | 8126         |
| employee_name   | Joey Smith	 |
| employee_salary | 49258        |
| employee_age    | 64           |
| profile_image	  |		 |

those steps have been created and step definition implemented in the first feature file lesson

Given Create Request "employee/{id}" with "GET" method
When Create URL segment for "id" with parameter "8126"
And Execute API

so now we will focus only on those steps

And Deserialize the employee api content
Then The employee should have the following values
|Key		  |Value	 |
| id              | 8126         |
| employee_name   | Joey Smith	 |
| employee_salary | 49258        |
| employee_age    | 64           |
| profile_image	  |		 |

After creating the test cases steps in the next lesson we will implement the step definitions