Skip to content

[Issue] Tests with conditions lead to infinite run #81

Description

@EugenePetrik

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);
        });
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions