I am looking to get the entire unique row based on test_type_to_run value, for example I want to only retrieve the rows having test_type_to_run==regression and skip the rows with 'smoke'
Feature: Add a new module using API
Scenario Outline: the admin can Add a project
Given need to call api with <type> for "createNewModule" and <apipayload> value and <test_type_to_run>
Given set header "Content-Type:application/json" with <role>
Given create payload as <apipayload>
When Call "createNewModule" api using "POST" method
Then validate the status code as <respcode> in response body
Then validate the message is returned as <message>
Then validate the DB records if the <message> is Success
}
Examples:
|type |apipayload |respcode|msg |role|test_type_to_run |
|ValidValues|ValidValsAPI |200 |Success|Tester|smoke|
|InValidVals |InValidValsAPI|400 |Error|Tester|smoke|
|ValidNumbers|ValidNumbersAPI|200 |Success|Developer|regression|
|ValidIntegers|ValidIntegersAPI|202 |Success|Developer Admin|regression|
|GarbageData|GarbageDataAPI|400 |Error|Developer Admin|regression|
Expected Test method:
@given(parsers.parse('need to call api with {type} for "{api}" and {api_payload} value and {test_type_to_run} with role {role}'))
def need_to_call_api_for(api, test_type, api_payload, test_type_to_run):
if test_type_to_run == "regression":
site_url = call_api(api, payload=api_payload, test_type=type, role=role)
The above function should only have below input based on test_type_to_run=="smoke":
|ValidValues|ValidValsAPI |200 |Success|Tester|smoke|
|InValidVals |InValidValsAPI|400 |Error|Tester|smoke|
Can something like this be possbible in pytest-bdd ?