Skip to main content

lr_eval_string function in loadrunner with examples

It evaluates a parameter and after evaluating the parameter it replaces the parameter with its current value.

You cannot place lr_eval_string in the middle of the web functions or any other functions. You can directly use in the web functions like this {URL}. It will replace the parameter with its current value.

Example 1:

Action()
{
    lr_save_string("http://www.google.com","URL");
    lr_output_message("%s"lr_eval_string("{URL}"));

    return 0;
}

Output:

Starting action Action.
Action.c(3): Notify: Saving Parameter "URL = http://www.google.com".
Action.c(5): Notify: Parameter Substitution: parameter "URL" =  "http://www.google.com"
Action.c(5): http://www.google.com
Ending action Action.

Example 2:

Action()
{
    int a=10;
    lr_save_int(a,"IntegerValue");
    lr_output_message("%s"lr_eval_string("{IntegerValue}"));
    lr_output_message("%d"atoi(lr_eval_string("{IntegerValue}")));

    return 0;
}

Output:

Starting action Action.
Action.c(4): Notify: Saving Parameter "IntegerValue = 10".
Action.c(5): Notify: Parameter Substitution: parameter "IntegerValue" =  "10"
Action.c(5): 10
Action.c(10): Notify: Parameter Substitution: parameter "IntegerValue" =  "10"
Action.c(10): 10
Ending action Action.

Comments

Post a Comment

Popular posts from this blog

File operations in loadrunner with examples

In this post I will explain how to capture a value from server response and save to a text file using vugen. How to capture and save to text file using loadrunner: First I have recorded the script using bing.com and then i searched for IBM. We will get 10 results. I have captured all the 10 values and saved to a file. Here is the code for that.

NeoLoad Interview Questions and Answers

Here are some of the interview questions and answers on NeoLoad: What is NeoLoad? NeoLoad is a performance testing tool designed to test different types of web, standalone and mobile applications. What is the difference between Loadrunner, JMeter and NeoLoad? Click here for differences What are the different counters you monitor in NeoLoad? Average Response Time(requests), average response time(pages), average requests/s, average throughput, current response time(requests), current response time(pages), current requests, current throughput, current users count, controller cpu load, controller memory load etc. What are the different type of tools you can integrate with NeoLoad? App Dynamics, CA APM Integration, Dyna trace integration, HP ALM or Quality Center Integration, Java and Jamo Solutions M-eux Test Integration, Jenkins Integration, perfecto mobile integration, selenium integration. What are the different type of Operating systems you can mon