top of page

Lr_eval_string Function In Loadrunner With Examples

Lr_eval_string Function In Loadrunner With Examples

By Sam Z // Wednesday, May 21, 2014

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.


bottom of page