Author qq:764714258, reprint please explain the source, read this article need good C Foundation
In LoadRunner, the pace of Web performance testing is written in the C language. C language has the concept of variables, LoadRunner tool with the concept of parameters, variables and parameters in LoadRunner is not the same thing
1, the Declaration of parameters (the temporary first call declaration, that is, you can call the definition of a parameter)
Lr_save_string ("Hello World", "Param"); Define a parameter and save "Hello World" to the parameter
2. The definition of LoadRunner variable is the same as C
Char A; Defines a variable a type char
3, lr_eval_string//Get the value of a parameter or variable
Char *lr_eval_string (const char * instring);
Lr_eval_string ("{param}"); Get the value of a parameter
Lr_eval_string (x); Get the value of a variable
4, lr_save_string//Save the string to the parameter
intlr_save_string (const char *param_value, const char*param_name);
Param_value: Value assigned to a parameter, parameter value
Param_name: Parameter name
Int return type
5, Lr_save_var
Intlr_save_var (const char * param_value, unsigned long const value_len, unsigned long c Onst options, const char *param_name);
Param_value: Parameter values
Value_len: The byte length of the value
Options: Parameter option, typically 0.
Param_name: Parameter name.
The Lr_save_var function assigns the specified variable-length string to the parameter. This function is useful when associating queries. You need to use lr_eval_string to determine the value of the parameter.
6. Variable conversion to parameters
Char x[3]; Define a variable
x= "10"; Assigning values to variables
Lr_save_string (x, "param"); assigning variables to parameters
Lr_eval_string ("{param}"); Print out the value of the parameter
7. parameter conversion to variable
Char x[100];
x= "{param}"
Lr_output_message ("The Parameter1 ' svalue is%s", lr_eval_string ("{param}"))
Analysis through function prototypes and usage
It can be concluded that the parameter plus {} Gets the value of the parameter, plus "" becomes a string, and the lr_eval_string () parameter turns into a temporary variable
Lr_save_string () Save the string to a parameter, why the parameter passed is a const cannot modify the value, because the first to pass the value is not allowed to modify, the second if the variable should be understood to allow the modification to save the value to be saved, in fact, is not the case, The second parameter is the const type, because the second argument is a file name, and the first parameter is created and then saved to the file
LoadRunner variable-to-parameter interchange