I have to mark the test case as passed and failed using an API on the basis of the responseCode
If response code is 200 I will mark it as pass else if it is not 200 (any other code 400, 401, 405, 204 etc ) I have to mark it as failed.
The first condition is working fine where it is == 200
. Now when I intentionally fail the API by changing method to get
then API returns 405 Method not Allowed
. In this case I am expecting it will go in !=200
condition but it is not doing that.
@test1
Scenario: create new users
And path 'users'
And request requestBody
When method post
Then status 200
* if (responseStatus == 200) karate.call('classpath:util/status.feature@testexecution', { value : '123' })
* if (responseStatus != 200) karate.call('classpath:util/status.feature@testexecution', { value : 'xyz' })