agent-js-postman icon indicating copy to clipboard operation
agent-js-postman copied to clipboard

[Issue] Tests with conditions lead to infinite run

Open EugenePetrik opened this issue 2 years ago • 1 comments

Tools:

  • Postman + Newman

If the test has conditions and the condition is false (we don't execute pm.test() {} in the condition block), I see the test in the report and it will never end.

Example:

let jsonData = JSON.parse(responseBody);

for (let i = 0; i < jsonData.data.length; i++) {
    let id = jsonData.data[i].id;

    pm.test("event id != null", function () {
        pm.expect(jsonData.data[i].id).to.not.eql(null);
    });

    let event_type = jsonData.data[i].attributes.type;

    if (event_type === "event") {
        pm.test("event type === null", function () {
            pm.expect(jsonData.data[i].relationships.event_type).to.eql(null);
        });
    }
}

EugenePetrik avatar Jun 21 '22 05:06 EugenePetrik

https://github.com/reportportal/agent-js-postman/pull/94

dgosantos89 avatar Jun 29 '23 20:06 dgosantos89