I am automating an api using pytest bdd.I need to implement
@pytest.mark.xfail
for one of my step definition. But after adding this decorator, its not working as expected.
Example >
example.feature
Scenario: Validate the API response where availableLicense should not be greater than the totalLicense.
Given Send valid input
Then validate the availableLicense count should not be greater than totalLicense.
test_example.py
@given('Send valid input')
def valid_data(context, url,token_url, api_key):
context.response = api_req('get',url, token_url, api_key)
@then('validate the availableLicense count should not be greater than totalLicense.')
@pytest.mark.xfail
def validate_license_count(context):
<some logic>
assert avail_license <= total_license
Still my test case is showing as failed when the above assertion got failed. What should I do here?