Highlighted
Frequent Contributor.
Frequent Contributor.
992 views

Advanced LR coding

Hi Guys,

Is it possible to hook into any LR action function like web_submit_data or web_custom_request and do event based coding? Like exception handling in Java programming.

Pseudo code:

read responses from ALL action functions
if (a pattern found in response)
    do something
else
    do something else

The point is not repeating a piece of code after each function.

Cheers.

0 Likes
5 Replies
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Advanced LR coding

Hello,

If you mean

if (found a pattern in response) then

 do something…

Then you should try the correlation features.

 If you mean some protocol level event, like when connections is build, before sending request, receiving response, an error happen…

Then there is no such user level interface for a common web_… API in web/http protocol, except for the asynchronous API, streaming API and websocket API.

They are target for simulating the asynchronous conversation, http streaming and web socket features in a Web/http application.

Just click on the links and see which one fit your requirement. 

Regards,

Bingle

0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Advanced LR coding

I actually I want to generalise the error outcomes and have smarter implementation of action functions. I am aware of all the correlations/extraction functions.

An example (totally hypothetical):

  1. Say a script with more than hundreds of requests (action functions like web_submit_data, web_custom_request etc)
  2. Correlation is done and dusted. Don't worry about it. No more uncaptured dynamic data.
  3. I know that my application fails in 50 different ways and it communicates that through response but not via response code or any general way that LR can detect. (LR is dumb and likes to follow HTTP codes, wouldn't find it).
  4. One thing I can do is do 50 text checks on the server response after every action functions and have conditional outputs or decisions to follow.
  5. I can even wrap the code above into a function and put them to make the script look cleaner. But that is still another step to be added.

What I was hoping to get:

  1. Can we tell LR to implement our checks after it has invoked ANY | selective action functions? Basically, right now loadrunner knows when response code is HTTP500 and fails it.
  2. Can we write something like, "on response code == HTTP500 --> do something"
  3. Hope I am not asking too much.

--- whew! ---

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Advanced LR coding

Hi,

This is an awesome idea. I really like it.

Unfortunately, it is not supported, at least not easily. In past we have implemented something like that in Mercury Performance Testing team with the help of the LoadRunner R&D team. We had to modify configuration files and get a hotfix from the R&D team. It was never productized, since it took much more effort to generalize the solution and make it available for customers to use. 

You can raise an enhancement request to be considered for future implementations. To raise an enhancement request you need to submit a regular support ticket with expectation to convert it to enhancement request.

Regards,

Shlomi

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Advanced LR coding

Hi

I know it will not fit all of your requirements, but what about "Content Check" in the runtime settings?

Here you at least can configure your 50 texts to look for and fail the transactions if they are found. But of course your suggestion would be more flexible and do more than just PASS/FAIL.

br /ola


Please mark post as solved if your problems or questions is/are resolved.
If this post was valuable to you, please consider kudo it.

.
0 Likes
Highlighted
Frequent Contributor.
Frequent Contributor.

Re: Advanced LR coding

Yes you are right. "Content Check" will help me fail something but not handle the failure.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.