Created
February 2, 2023 10:54
-
-
Save burcuakkayaa/6b3a2cf7e5b4ecd805621f697b333c66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Grocery API | |
Background: The Request Body Configuration | |
# Set a configuration for the payload | |
* url baseUrl | |
Scenario: Get All Products from Grocery | |
Given header Content-Type = 'application/json' | |
And path '/allGrocery' | |
When method get | |
Then status 200 | |
And match response.data[*].id == '#present' | |
And match response.data[*].price == '#present' | |
And match response.data[*].name == '#present' | |
And match response.data[*].stock == '#present' | |
Scenario Outline: Get Grocery Details with a name | |
Given header Content-Type = 'application/json' | |
And path '/allGrocery/<name>' | |
When method get | |
Then status 200 | |
And match response.data[0].name == "<name>" | |
And match response.data[0].id == '#present' | |
And match response.data[0].price == '#present' | |
And match response.data[0].stock == '#present' | |
Examples: | |
| name | | |
| apple | | |
| grapes | | |
Scenario: Add a new product to the Grocery Basket | |
* def jsonBody = | |
""" | |
{ | |
"id": 4, | |
"name": "string", | |
"price": 12.3, | |
"stock": 3 | |
} | |
""" | |
Given header Content-Type = 'application/json' | |
And path '/add' | |
And request jsonBody | |
When method post | |
Then status 201 | |
And response.message == "success" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment