0

I'm recording test scenarios via the JMeter recorder (without having HTTP Header Manager) and I have noticed that, for example, I have a sampler which holds header value local:81/web/eprocess/login.aspx. I'm not even using that port anymore and there is another part from the URL that is no longer the same. Anyway my scripts seem to work no matter that. How is this possible?

Next, I added a HTTP Header Manager and added some of the values that exist in most of the headers to the Header Manager. I then commented all of my default headers and the scripts seem to work again (no matter the default headers are sending values which doesn't exist in the HTTP Header Manager - scripts still work - how?

My main question is: What is a the good way to create long-term usable scripts with the host, port or even other information from the headers changing?

Is it better to leave the headers no matter if they hold incorrect information (different ports different application specific stuff like document IDs task IDs and more) or create a HTTP Header Manager and remove all other headers which contain some UNIQUE to some samplers values (but still work without sending those values). Here is a attachment of the HTTP Header Manager:

enter image description here

There is a random header which works just fine no matter I'm not even using this specific port anymore and the did=2860 number is around 5000 now but still works.

Also other values mismatch from the Header Manager values and if I comment this header it still works no matter Header Manager doesnt contain those values.

gung - Reinstate Monica
  • 11,583
  • 7
  • 60
  • 79
Boka
  • 347
  • 1
  • 10

1 Answers1

2

If you don't know whether removing any headers would alter application behavior, then it's better to preserve all headers JMeter have recorded. However, a better approach (if possible) is reviewing headers with people who would know which of them matter, and preserving only the meaningful ones. Usually it comes to 3 questions: which headers load balancer (if it exists) uses for processing the requests, then which headers are used by a web server, and finally whether web application itself cares about any headers.

But whichever approach you choose, do not leave headers with wrong values. Use variables / dynamic values instead.

For instance for Referer (if you know that you need it or you are not sure, if it is used) specify it as ${siteUrl}/web/eprocess/<...>, and have ${siteUrl} defined either as a static script variable (if it never changes during the execution of the test), or dynamic value that can come from the previous request for example.

From other headers you have, most likely important are:

  • all three Accept* headers are almost always important,
  • so are "Content-Type".

Even if they don't alter behavior visibly, they usually do for web server and web app. Others could go either way:

  • X-* are custom headers, may or may not be important for your app (but you should ask developers really)
  • Referer is not important in many cases, but sometimes it is
  • "User-agent" may or may not be important. For example some web applications would not allow requests without User-agent; others would alter their behavior based on the value inside User-agent, say, when they identify that you are on Windows vs. Mac.
  • Cache-control may or may not be important, see this
Community
  • 1
  • 1
timbre timbre
  • 12,648
  • 10
  • 46
  • 77