The Web_reg_save_param function is primarily used in associations, and the association is used most of the time when the automatic association of LoadRunner does not work.
And I want to say is this function two different use method, of course there may be a better way, perhaps I said not all right, welcome to correct, hehe ~ ~ ~
First: When you set up checkpoints, you can use it to troubleshoot why checkpoints fail.
In the performance test test, we have to set the text or picture checkpoint to improve our test script confidence. No checkpoint how to confirm our script this request is correct ~ ~ You say yes ~?
However, we often encounter, according to the response set up checkpoints, but dead and alive can not find the contents of the situation.
This time, you can let Web_reg_save_param play,
Web_set_max_html_param_len ("1024");
Web_reg_save_param ( " test " " lb/ic= " " rb/ic=, " notfound=error " search=body
In front of the request to get the content,
Then use Lr_output_message (lr_eval_string ("{test}")), the function output to log, you can troubleshoot, the requested return content tangled is not what is needed.
In addition to Web_set_max_html_param_len ("1024"), it may be necessary to set the setting size, otherwise the content may be response too long to display intact.
The second type: In some test scenarios, you need to get an ID or other value for the next request to submit the data
And I was in a situation where, in a single test, there was a list of events, and each event had an ID to identify, and when the event needed to be handled, the ID identifier must be brought in the request.
Looking at the page, I found the HTML I needed to get the value, as follows:
<Listyle= "Cursor:pointer"ID= "event_li_200"class= "Event_list_liact"><H3>Test Data 1 #200</H3><bclass= "Event_listli_okay">Medium</b><P>Location: Test Data 2</P><P>Duration: 28 days 20 hours ago</P></Li>
Id= "event_li_200" where 200 is the value I need to get, add it before the request
Web_reg_save_param ("event_id", "lb/ic=id=\ "Event_li_", "rb/ic=\ "", "Notfound=error", "ord=1", "Search=body", last);
There are two points below, one is " need to add \ Escape, the other is ord=1 based on the search criteria will return multiple values, whichever is the first one."
Another question to add here is that I encountered an asynchronous request in the actual test, using the Web_reg_save_param function directly to get the desired value.
And my approach is to separate the requests I need, using a function request alone, and write a web_reg_save_param before it.
The event ID is obtained according to the above method, saved to the event_id variable, and then used in the function that submits the data ~yeah!!!