Error when running a collection, when return code is 200?

Hi,

when I run a collection even though my call returns 200, the item in the collection run summary shows up as failed with a status code of 200.

Here are the results of the run

Here is my test

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);

    var json = pm.response.json();

    pm.environment.set('currentClient_Buyer', json._id);
    var currentClient_Seller = pm.environment.get("currentClient_Buyer");
    console.log('currentClient_Buyer', currentClient_Buyer);
});

what is interesting is when I run each of the steps from the collection one by one, they all succeed with 200! but when I run the collection, the “Buyer” call ALWAYS fails with a 200.

Are you sure your not getting a script error?

Is it logging out the variable you’re setting?

Could give this a go:

pm.environment.set('currentClient_Buyer', json["_id"]);

You’re not logging that variable correctly either as it would be undefined.

It’s hard to get the full context from just that static image.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.