Performance Testing Script Issue In Postman

Hi,

I am trying to use performance testing feature in Postman. So, I have collection and inside collection I have endpoints, and in collection, inside Pre-request, I have written script to add request headers before making requests. When I run my collection by using collection runner, and choose functional testing, everything works fine, I get success response. But, when I choose performance testing and run it, I get 100% error. I checked the Errors section, and there I see that, the script inside the collection that is responsible for adding request headers before sending the request is not getting implemented as there is no headers applied for the requests made in performance testing.

So, to be clear, I follow same 2 exact steps, for one, I choose functional, everything works fine, script is getting implemented, headers are getting added etc. In Performance testing, script is getting ignored and I get 404

Hey @orbital-module-par10 :waving_hand:t3:

Welcome to the Postman Community :postman:

Could you share more details about the request structure, please? A visual example would be best.

A 404 would suggest the route isn’t found, what is the header that’s getting applied?

Is that determining the part of the URL?

Hey @orbital-module-par10 :waving_hand:

I set up a dummy Performance Testing run using the RequestBin service to see the Pre-Request Script getting executed as part of the run.

A basic script to set a random word to use in the request body:

Setting the variable syntax in the request body which will resolve to the created random word:

The Collection being run in a Performance Test:

The service receiving the request with the resolved variable in the request body:

Adding scripts to a request and executing them during a Performance Run is working as expected, this is a very basic example so there might be other things happening on your side which are causing the issues for you.

Hi, Danny, Thanks a lo for helping.

so I will explain my case. This is the script I use in Pre-request tab for the endpoint:

As you can see, it gets some variables from vault. And for now, I changed some values, so when I make normal request, I get 404, but the headers are getting added into the request header.
This is some part of request header I got from postman:

As you can see, script successfully read the object and add relevant headers.

Now, when I use performance testing, I again get 404 but when I check request headers by navigating to Errors tab, I can’t see the same headers in the request.

I also checked your example, and yes, it worked, successfully adding randomword when making request in performance test, but in my case, headers are not getting added

Thank you @orbital-module-par10

The additional information here about what your script is actually doing is very helpful as now we also know that the Postman Vault is part of the script, it’s not just a simple case of adding headers to a request.

Let me take a closer look at this about get back to you with some answers.

Yeah, I also first thought it is related to using vault, but the thing is even the static values like Project-Name is not getting added into the header, so it is not only about vault variables, but overall headers object is getting ignored

1 Like