当前位置: 首页 > news >正文

Loadrunner 关于参数赋值取值的操作

1.参数的赋值和取值
lr_save_string("hello world","param");
lr_eval_string("{param}");
2.变量到参数
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.变量读参数
char x[100];
x="{param}";
lr_save_string("hello world","param");
lr_eval_string(x);

 

1 lr_eval_string(), eval应该是evaluate的缩写。
功能 如果只有一个参数,则返回当前参数的值。它的参数必须是{newParam} 的形式,也就是被大括号包起来
应用:对每个迭代过程中需要需要使用参数化的内容的时候。lr_output_message("value : %s", lr_eval_string("The row count is: {row_cnt}"));

例如:有一个int的参数化值{paraInt},如果直接把它作为一个int是错的。必须atoi(lr_eval_string({ParaInt}))
所以不能直接把一个int变量作为参数。
2.如何实现“我想把iTemp转换成字符串存到变量chArr里”
int iTemp=3;
char chArr[1024] = {0};
// if not unicode
itoa( itemp, charr, 10  );
应该可以

 

 

parameter和argument的区别

转载自: http://smilejay.com/2011/11/parameter_argument/

在对一个函数写一个注释时,我在考虑到底该用parameter还是用argument来描述其参数呢。

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

1. parameter是指函数定义中参数,而argument指的是函数调用时的实际参数。

2. 简略描述为:parameter=形参(formal parameter), argument=实参(actual parameter)。

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

While defining method, variables passed in the method are called parameters.
当定义方法时,传递到方法中的变量称为参数.
While using those methods, values passed to those variables are called arguments.
当调用方法时,传给变量的值称为引数.(有时argument被翻译为“引数“)

一个C++的例子来说明二者的区别:

[Copy to clipboard]View Code CPP
1
2
3
4
5
6
7
8
9
10
11
12
[cpp] view plain copy
  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 are 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.    
  4. <span style="color:#0000ff">int</span> main<span style="color:#008000">(</span><span style="color:#008000">)</span>  
  5. <span style="color:#008000">{</span>  
  6.   <span style="color:#0000ff">char</span> c<span style="color:#008080">;</span>  
  7.   <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>  
  8.   func<span style="color:#008000">(</span><span style="color:#0000dd">5</span>, p<span style="color:#008000">)</span><span style="color:#008080">;</span> <span style="color:#666666">//5 and p are arguments</span>  
  9.   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="color:#666666">//'long' is an argument</span>  
  10.   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>  
  11.   <span style="color:#0000ff">return</span> <span style="color:#0000dd">0</span><span style="color:#008080">;</span>  
  12. <span style="color:#008000">}</span>  


如下叙述,来自wikipedia:
http://en.wikipedia.org/wiki/Parameter_%28computer_programming%29

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

Parameters and arguments
————————————————
These two terms are sometimes loosely used interchangeably; in particular, “argument” is 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 an intrinsic property of the procedure, included in its definition. For example, in many languages, a minimal procedure to add two supplied integers together and calculate the sum total would need two parameters, one for each expected integer. In general, a procedure may be defined with any number of parameters, or no parameters at all. If a procedure has parameters, the part of its definition that specifies the parameters is called its parameter list.

By contrast, the arguments are the values actually supplied to the procedure when it is 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 is called, the part of the procedure call that specifies the arguments is called the argument list.

Although parameters are also commonly referred to as arguments, arguments are more properly thought of as the actual values or references assigned to the parameter variables when the subroutine is called at run-time. When discussing code that is calling into a subroutine, any values or references passed into the subroutine are the arguments, and the place in the code where these values or references are given is the parameter list. When discussing the code inside the subroutine definition, the variables in the subroutine’s parameter list are the parameters, while the values of the parameters at runtime are 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 refers to the actual value passed (argument).

转载于:https://www.cnblogs.com/zhengah/p/4782105.html

相关文章:

  • 核心组件
  • EF 常见语句以及sql语句简单 后续继续添加
  • Javascript -- 精通Math对象
  • 基于TLS(线程局部存储)的高效timelog实现
  • 当一个java程序员到底有多难
  • [纯干货] MySQL索引背后的数据结构及算法原理
  • traffic and backfill
  • 简单的转义字符
  • Eclipse自动补全设置
  • ${factoryList }后面有空格不影响
  • 再看BP神经网络
  • JavaScript深浅拷贝
  • 节约内存:Instagram的Redis实践
  • 智云大咖秀:怎样的稳定器才是摄影师的“灵魂辅助”?
  • Bootstrap vs Foundation如何选择靠谱前端框架
  • 2017-09-12 前端日报
  • Android 架构优化~MVP 架构改造
  • Angular 响应式表单之下拉框
  • css属性的继承、初识值、计算值、当前值、应用值
  • IndexedDB
  • javascript数组去重/查找/插入/删除
  • js学习笔记
  • Koa2 之文件上传下载
  • Lucene解析 - 基本概念
  • Nodejs和JavaWeb协助开发
  • Python socket服务器端、客户端传送信息
  • Python学习笔记 字符串拼接
  • rabbitmq延迟消息示例
  • scrapy学习之路4(itemloder的使用)
  • storm drpc实例
  • TiDB 源码阅读系列文章(十)Chunk 和执行框架简介
  • vuex 笔记整理
  • 基于web的全景—— Pannellum小试
  • 记一次和乔布斯合作最难忘的经历
  • 开年巨制!千人千面回放技术让你“看到”Flutter用户侧问题
  • 面试遇到的一些题
  • 你不可错过的前端面试题(一)
  • 想写好前端,先练好内功
  • 小程序01:wepy框架整合iview webapp UI
  • 职业生涯 一个六年开发经验的女程序员的心声。
  • 函数计算新功能-----支持C#函数
  • # Pytorch 中可以直接调用的Loss Functions总结:
  • #define、const、typedef的差别
  • #Z0458. 树的中心2
  • #我与Java虚拟机的故事#连载05:Java虚拟机的修炼之道
  • (007)XHTML文档之标题——h1~h6
  • (1综述)从零开始的嵌入式图像图像处理(PI+QT+OpenCV)实战演练
  • (31)对象的克隆
  • (function(){})()的分步解析
  • (k8s中)docker netty OOM问题记录
  • (ros//EnvironmentVariables)ros环境变量
  • (三) diretfbrc详解
  • (三) prometheus + grafana + alertmanager 配置Redis监控
  • (转)从零实现3D图像引擎:(8)参数化直线与3D平面函数库
  • .class文件转换.java_从一个class文件深入理解Java字节码结构