This is my framework structure currently
CreateDiscount.feature
Discount_Payload.json
SearchDiscount.feature
Search_Payload.json
This is how the code in each file looks CreateDiscount.feature
Scenario: Create a discount
* def changes = read('Discount_Payload.json')
* set changes.code = cu.getCouponCode(4)
* set changes.operator = 'LT'
Given url baseUrl + CREATE_DISCOUNT
And request changes
When method post
Then status 200
Discount_Payload.json
{
"code": "ND12",
"name": "NDS coupon Testing",
"description": "NDS coupon testing via postman",
"operator": "EQ"
}
SearchDiscount.feature
Scenario: Create a discount and search it
* def createDiscount = call read('CreateDiscount.feature')
* print createDiscount
* def coupon_code = createDiscount.changes.code
* print coupon_code
* def changes = read('Search_Payload.json')
* set changes.coupon_code = coupon_code
Given url baseUrl + SEARCH
And request changes
When method post
Then status 200
Search_Payload.json
{
"mode" : "Browse",
"coupon_code" : "abrakadabra"
}
So currently whenever I run SearchDiscount.feature , It internally calls CreateDiscount.feature , This is fine if I have only code and operator values to be set while creating discount.
But now when I want to run separate test case in SearchDiscount.feature for which I want to update the value of name and description of Discount_Payload.json also from SearchDiscount.feature.