How to capture the Header Request in loadrunner

1,247 views
Skip to first unread message

Ranjana Sharma

unread,
Jan 31, 2017, 9:32:34 AM1/31/17
to LoadRunner
HI Experts,

I need your kind advice. I am stuck with capturing the request cookie. I have to capture request cookiee and then write this to a C file. so  that my development team can check token generation for 100 Users Load.. 

Please adivce,

I have used correlation but  no sucess web_reg_save_param("sParam1", "LB= ", "RB=","NotFound=Warning", "Search=Headers", LAST);

James Pulley

unread,
Jan 31, 2017, 10:08:48 AM1/31/17
to LoadRunner
What have you tried to capture the cookie value beyond what is noted?   It would also seem that your developer is attempting to shape your test into a functional test.  Is it possible that this has not been validated in functional testing already?

I would suggest to you that your requirement to capture cookies and write them to a file yourself is going to cause issues as the disk writes will act as a drag anchor to your virtual user execution as every user challenges for access to the write head....and if you are writing them all to the same file then you will have to manage lock issues.   May I suggest a different path?

Consider one of the following to minimize the overhead:

  • Capture the cookie value once and only once per user/iteration instead of each request where a cookie value appears.
  • Examine the following options for capturing the information for later use:
    • lr_output_message() to send the information to the controller output window.  You can then export the information for the developer at the conclusion of the test
    • lr_message() combined with a changing of the log options dynamically in your code, to write out the information to the standard user log, returning to no log or log only on error after writing this information out.   I do not recommend lr_error_message() because this is likely to distort your error stats in the controller for your test execution
  • VTS (or my favorite, rabbitMQ).   Write the information on the virtual user number, iteration number, test identifier and cookie values to a queue for collection later.  Make sure you do not include this write inside of a timed transaction as this would be for a non system under test request.   VTS is "in the box," however I prefer RabbitMQ.   You can also hit RabbitMQ as a managed service on the IBM Public cloud.   Also, as a note, you could also make use of the simple queue service on Amazon.   I brining up the serverless computing options in public cloud providers as an option which is easy to provision since you do not need an additional service, options which have exposed HTTP interfaces and also have free tiers for particular numbers of messages.   So, odds are you could get away with a number of tests before you had to shell out a couple of dollars. If you were truly evil then you could have a small piece of code run to pull messages off of the queue and send the developer an email with each value while the test runs.  If you are less evil then you can simply have an agent pull the value from the queue and write it to a single file.  This way you have one user writing the information to a single file and this user need not even be a part of the load generator infrastructure upon which the test is running.

rahul sharma

unread,
Feb 1, 2017, 10:53:32 AM2/1/17
to LR-Loa...@googlegroups.com
Thanks James Sir,

But if in am not wrong web_reg_save_param function works for getting values from server reponse. but dev team is telling me to capture request cookie for particular request. Which i dont know how to get this from loadrunner .. If you can share me i will be thankful to you

--
You received this message because you are subscribed to the Google Groups "LoadRunner" group.
To unsubscribe from this group and stop receiving emails from it, send an email to LR-LoadRunner+unsubscribe@googlegroups.com.
To post to this group, send email to LR-Loa...@googlegroups.com.
Visit this group at https://groups.google.com/group/LR-LoadRunner.
To view this discussion on the web visit https://groups.google.com/d/msgid/LR-LoadRunner/3466bb40-b270-4c9a-9d41-1c2975671f22%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
With Regards
Rahul sharma

James Pulley

unread,
Feb 1, 2017, 1:06:28 PM2/1/17
to LoadRunner
See "Set Cookie:" and "Headers"


On Wednesday, February 1, 2017 at 10:53:32 AM UTC-5, rahul sharma wrote:
Thanks James Sir,

But if in am not wrong web_reg_save_param function works for getting values from server reponse. but dev team is telling me to capture request cookie for particular request. Which i dont know how to get this from loadrunner .. If you can share me i will be thankful to you

Shane Donaghy

unread,
Feb 27, 2018, 12:07:47 AM2/27/18
to LoadRunner
Hi All,

I think the OP is aware of web_reg_save_param_ex() function.
I think his problem is the same as I am having; how to correlate the value when its in the request header.
web_reg_save_param_ex() listens for a value with LB && RB in the following steps response.

It's like it's a client-side generated value.

Any ideas?
Thanks,
Shane


On Wednesday, February 1, 2017 at 6:06:28 PM UTC, James Pulley wrote:
See "Set Cookie:" and "Headers"

On Wednesday, February 1, 2017 at 10:53:32 AM UTC-5, rahul sharma wrote:
Thanks James Sir,

But if in am not wrong web_reg_save_param function works for getting values from server reponse. but dev team is telling me to capture request cookie for particular request. Which i dont know how to get this from loadrunner .. If you can share me i will be thankful to you
On Tue, Jan 31, 2017 at 8:38 PM, James Pulley <loadrunn...@jamespulley.com> wrote:
What have you tried to capture the cookie value beyond what is noted?   It would also seem that your developer is attempting to shape your test into a functional test.  Is it possible that this has not been validated in functional testing already?

I would suggest to you that your requirement to capture cookies and write them to a file yourself is going to cause issues as the disk writes will act as a drag anchor to your virtual user execution as every user challenges for access to the write head....and if you are writing them all to the same file then you will have to manage lock issues.   May I suggest a different path?

Consider one of the following to minimize the overhead:

  • Capture the cookie value once and only once per user/iteration instead of each request where a cookie value appears.
  • Examine the following options for capturing the information for later use:
    • lr_output_message() to send the information to the controller output window.  You can then export the information for the developer at the conclusion of the test
    • lr_message() combined with a changing of the log options dynamically in your code, to write out the information to the standard user log, returning to no log or log only on error after writing this information out.   I do not recommend lr_error_message() because this is likely to distort your error stats in the controller for your test execution
  • VTS (or my favorite, rabbitMQ).   Write the information on the virtual user number, iteration number, test identifier and cookie values to a queue for collection later.  Make sure you do not include this write inside of a timed transaction as this would be for a non system under test request.   VTS is "in the box," however I prefer RabbitMQ.   You can also hit RabbitMQ as a managed service on the IBM Public cloud.   Also, as a note, you could also make use of the simple queue service on Amazon.   I brining up the serverless computing options in public cloud providers as an option which is easy to provision since you do not need an additional service, options which have exposed HTTP interfaces and also have free tiers for particular numbers of messages.   So, odds are you could get away with a number of tests before you had to shell out a couple of dollars. If you were truly evil then you could have a small piece of code run to pull messages off of the queue and send the developer an email with each value while the test runs.  If you are less evil then you can simply have an agent pull the value from the queue and write it to a single file.  This way you have one user writing the information to a single file and this user need not even be a part of the load generator infrastructure upon which the test is running.

  

On Tuesday, January 31, 2017 at 9:32:34 AM UTC-5, Ranjana Sharma wrote:
HI Experts,

I need your kind advice. I am stuck with capturing the request cookie. I have to capture request cookiee and then write this to a C file. so  that my development team can check token generation for 100 Users Load.. 

Please adivce,

I have used correlation but  no sucess web_reg_save_param("sParam1", "LB= ", "RB=","NotFound=Warning", "Search=Headers", LAST);

--
You received this message because you are subscribed to the Google Groups "LoadRunner" group.
To unsubscribe from this group and stop receiving emails from it, send an email to LR-LoadRunne...@googlegroups.com.

To post to this group, send email to LR-Loa...@googlegroups.com.
Visit this group at https://groups.google.com/group/LR-LoadRunner.

Abhishek Banginwar

unread,
Feb 27, 2018, 7:41:28 AM2/27/18
to LR-Loa...@googlegroups.com
Probably one of two happens;

1. Unique token is supplied by server in first or one of initial requests. 
2. Unique token generated by client in certain format.

If it is option one, try to find it in extended logs or recording logs.
If it is option two, generate the value yourself and write it in file; no correlation required.

Reply all
Reply to author
Forward
0 new messages