Skip to content

Feature File: Status Code

Mahmoud A. Zaid edited this page Mar 13, 2019 · 4 revisions

Let's create feature file and generate our first test case that test the response status code

1. Right-Click on Features folder > Add > New Item > SpecFlow Feature File

2. Right-Click on StepDefentions folder > Add > New Item > SpecFlow Step Defention

3. Write the below Gherkin syntax in the feature file

Feature: GetSingleEmployeeApi
	This page will contains information about, how to access particular employee data using rest api /employee.

Scenario: Check Get Single employee status
Given Create Request "employee/{id}" with method "GET"
When Create URL segment for "id" with parameter "7337"
And Execute API
Then returned status code will be "200"

4. Right-Click inside feature file > Generate Step Defentions > Copy Methods to Clipboard

5. StepDefentions Folder > Open StepDefnetion File > in the class Paste the copied methods

Clone this wiki locally