I have a Karate Test scenario where I need to execute certain Test statements based on a condition i.e Environment .If karate.env = QA then a particular statement should not execute. in all other cases that statement should execute.
Example:
@Search
Scenario Outline: Verify the search Service Response for Search keyword
Given url baseSeviceURL
And path '/searchService'
And params { searchTerm: '<SearchTerm>'}
And method get
And status 200
Then assert response.productDetails.count() > 1
Examples:
|SearchTerm |
| book |
*Here I want to execute the statement -
Then assert response.productDetails.count() > 1; only if karate.env == QA
, which I am setting through Maven as a command line parameter.
The Gherkin syntax does not allow the if else logic to be written in Feature files ... is there any karate Library methods for achieving this ..