Can I Skip set of tests during Performance Testing

Hi all,

I am new to Postman and Performance Testing. Currently I am developing a framework where set of APIs are getting testing in one string of test, for example.

Check Event API
Create Basket API
Update Basket API
Create Order API.

When POST request is sent for Basket API, it should return with BasketID which is getting stored in global variable as a BasketID, which is then used for update Basket API and Create Order API.

However, during performance testing, BasketID was empty because of Bad Request 400 in Create Basket API.

Can I create a simple script to check, if BasketID is empty skipp test
Update Basket API & Create Order API.

Thank you in Advance.

You are conflating requests and tests.

You have four requests, which may have one or more tests in them (or no tests at all).

On your “Create Basket” response. You can have an IF statement that checks the status code and then use setNextRequest(null) to stop running any more requests in the collection.

if (pm.response.code===400) {  
    pm.execution.setNextRequest(null);
}

Will this be used during Performance Testing, or will it only work for Functional Testing.

The issue we are facing if basketid is empty the order API shows error, and as we are doing demo to customer, they see unnecessary error for Order API, which we want to avoid.

I don’t use the performance testing functionality, but as far as I’m aware the pre and post response scripts will run. Have you tried it?

You just need to be careful with the scripts, because they do still take up processing time. So keep the assertions on a performance run to a minimum or they can skew the results.

However, surely you should be in control of your test data. Which means you shouldn’t have any empty basket ID’s. Use a data file to ensure that the data for the performance run is valid.

This is important during functional testing, but I can’t see why it wouldn’t be important for your API performance test as well.

Every time you run the performance test, you should see similar results so you can measure performance over time, or after you have implemented a new feature into the API so you can regression test that you haven’t affected the existing performance.

I could maybe see an scenario where you want a mix of success and failures to fully test your API. (Where the expected result would be a 400, but that should be driven from the data file).

1 Like

So my argument was same, I do not want to control because I want to test the API performance if there is a failure, I want to see how API will behave. I have managed to prove myself by doing some testing and found an issue. If API receives an empty basket, its returning bad request error, but at the same time it looses it self for a minute and any order coming during that period get’s lost. so in busy period, we are on avr losing 200 orders in an hour.

So now I am good and don’t want to skip :slight_smile:

Thank you for all your support

1 Like