LoadRunner operation on value of parameter assignment

Source: Internet
Author: User

1. Assigning and taking values of parameters
Lr_save_string ("Hello World", "Param");
Lr_eval_string ("{param}");
2. Variables to parameters
int x;
Char *y;
y= "Hello";
x=10;
Lr_save_int (x, "param");
Lr_save_string (Y, "param1");
Lr_eval_string ("{param}");
Lr_eval_string ("{param1}");
3. Variable reading parameters
Char x[100];
x= "{param}";
Lr_save_string ("Hello World", "Param");
Lr_eval_string (x);

1 lr_eval_string (), eval should be an abbreviation for evaluate.
function returns the value of the current parameter if there is only one argument. Its arguments must be in the form {Newparam}, which is the curly braces.
Application: When you need to use parameterized content for each iteration of the process. Lr_output_message ("Value:%s", lr_eval_string ("The row count is: {row_cnt}"));

For example: There is a parameterized value of int {Paraint}, if it is wrong to directly take it as an int. Must Atoi (lr_eval_string ({paraint}))
Therefore, you cannot directly use an int variable as a parameter.
2. How to implement "I want to convert the itemp into a string into a variable Charr"
int itemp=3;
Char charr[1024] = {0};
If not Unicode
Itoa (Itemp, Charr, 10);
It should be ok

The difference between parameter and argument reprinted from: http://smilejay.com/2011/11/parameter_argument/

When I write a comment on a function, I consider whether I should use parameter or argument to describe its parameters.

根据网上一些资料,对parameter和argument的区别,做如下的简单说明。

1. Parameter refers to the parameters in the function definition, and argument refers to the actual arguments when the function is called.

2. Briefly described as: parameter= parameter (formal parameter), argument= argument (actual parameter).

3. 在不很严格的情况下,现在二者可以混用,一般用argument,而parameter则比较少用。

While defining method, variables passed in the method is called parameters.
When you define a method, the variable passed to the method is called a parameter.
While using those methods, the values passed to those variables is called arguments.
When a method is called, the value passed to the variable is called an argument. (sometimes argument is translated as "arguments")

A C + + example to illustrate the difference:

[Copy to clipboard]View Code CPP
123456789101112
[CPP]View Plaincopy
  1. <span style="color: #0000ff" >void</span> func<span style="color: #008000" > (</span ><span style="color: #0000ff" >int</span> N, <span style="color: #0000ff" >Char </span> <span style="color: #000040" >*</span> pc<span style="color: #008000" >) </ Span><span style="color: #008080" >;</span> <span style="color: #666666" >//n and PC is parameters</span>
  2. <span style="color: #0000ff" >template</span> <span style="color: #000080" ><</ Span><span style="color: #0000ff" >class</span> t<span style="color: #000080" >> </span> A <span style="color: #008000" >{</span><span style="color: #008000" >}</ Span><span style="color: #008080" >;</span> <span style="color: #666666" >//t is a A parameter</span>
  3. <span style="color: #0000ff" >int</span> main<span style="color: #008000" > (</span ><span style="color: #008000" >) </span>
  4. <span style="color: #008000" >{</span>
  5. <span style="color: #0000ff" >char</span> c<span style="color: #008080" >;</span>
  6.   <span style= "color: #0000ff" > char</span> <span style= "color: #000040" >* </span>p <span style= "color: #000080" >=</span> <span  style= "color: #000040" >&</span>c<span style= "color: #008080" >;</SPAN>&NBSP;&NBSP;
  7.   func<span style= "color: #008000" > (</span><span  Style= "color: #0000dd" >5</span>, p<span style= "color: #008080" >;</span>  <span style= "color: #666666" >//5 and p  are arguments</span>  
  8.   a<span style= "color: #000080" ><</span>< Span style= "color: #0000ff" >long</span><span  style= "color: #000080" >></span> a<span style= "color: #008080" >;</span> <span style=//' long '  is an argument</span>  
  9. A<span style="color: #000080" ><</span><span style="color: #0000ff" >char</span ><span style="color: #000080" >></span> another_a<span style="color: #008080" >;</ span> <span style="color: #666666" >//' char ' is an argument</span>
  10. <span style="color: #0000ff" >return</span> <span style="color: #0000dd" >0</span ><span style="color: #008080" >;</span>
  11. <span style="color: #008000" >}</span>


As described below, from Wikipedia:
Http://en.wikipedia.org/wiki/Parameter_%28computer_programming%29

Just as in standard mathematical usage, the argument are thus the actual value passed to a function, procedure, or routine (such as x in log x), whereas the parameter are a reference to that value inside the implementation of the function (log in This case). See the Parameters and Arguments sections for more information.

Parameters and arguments
————————————————
These terms is sometimes loosely used interchangeably; In particular, "argument" was sometimes used in place of "parameter". Nevertheless, there is a difference. Properly, parameters appear in procedure definitions; Arguments appear in procedure calls.

A parameter is a intrinsic property of the procedure, included in its definition. For example, in many languages, a minimal procedure to add, supplied integers together and calculate the sum total Woul d need-parameters, one for each expected integer. In general, a procedure is defined with any number of parameters, or no parameters at all. If a procedure have parameters, the part of the IT definition that specifies the parameters are called its parameter list.

By contrast, the arguments was the values actually supplied to the procedure when it was called. Unlike the parameters, which form an unchanging part of the procedure's definition, the arguments can, and often do, vary From call to call. Each time a procedure was called, the part of the procedure call that specifies the arguments is called the argument list.

Although parameters is also commonly referred to as arguments, arguments is more properly thought of as the actual value s or references assigned to the parameter variables when the subroutine was called at Run-time. When discussing code this is calling to a subroutine, any values or references passed to the subroutine is the Argume NTS, and the place in the code where these values or references is given is the parameter list. When discussing the code inside the subroutine definition, the variables in the subroutine ' s parameter list is the Parame Ters, while the values of the parameters at runtime is the arguments.

Many programmers use parameter and argument interchangeably, depending on context to distinguish the meaning. The term formal parameter refers to the variable as found in the function definition (parameter), while actual parameter R Efers to the actual value passed (argument).

LoadRunner operation on value of parameter assignment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.