Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleTerminating test runsSimple Example
tests["Status code is 201/202"] = responseCode.code === 201 || responseCode.code === 202;

if (responseCode.code != 201 && responseCode.code != 202) {
    tests["Scrap this run:  Domain not created"] = true === false;
    postman.setNextRequest(null);
}
Code Block
languagejs
titleMore Complex Example
tests["Status code is 201/202"] = responseCode.code === 201 || responseCode.code === 202;

if (responseCode.code == 201 || responseCode.code == 202) {
    //
    // #1: do stuff like make sure there is a response body and
    // retrieve env vars to be used by other tests in this
    // collection
    //
}
else {
    //
    // #2: Bail on the collection run
    //
    tests["Scrap this run:  Domain not created"] = true === false;  
    postman.setNextRequest(null);
}
//
// #3: Could add more extensive stuff beyond #1 here
//

...