mercredi 21 novembre 2018

Use of conditional statement results in assertion failure

I am using following conditional statement in Postman:-

if (tests["Body does have verification finished string"] = (responseBody.has("verification.finished"))){
console.log('Hi');
}
else {
postman.setNextRequest("Webhooks Url status check");
}

If the condition is false, the Jenkins job fails with an assertion error in the script stating.

1. Body does have verification finished string
2â „ AssertionFailure in test-script

Attempting to set next request to Webhooks Url status check

I don't understand the reason of job failure? It should simply execute the false condition instead of throwing assertion failure.

I am using --bail option to stop the run if any of the assertions fails, can this be caused by --bail? If so, how can I put a stop to the run after a certain amount of next requests else I am afraid it can go into infinite loop.

Aucun commentaire:

Enregistrer un commentaire