LoadRunner中有lr_save_int() 和lr_save_string() 函数,但是没有保存浮点数到变量的lr_save_float函数。《lr_save_float() function forLoadRunner》这篇文章介绍了如何写一个这样的函数:
http://ptfrontline.wordpress.com/2010/01/27/lr_save_float-function-for-loadrunner/
void lr_save_float(const float value, const char *param, const int decimals)
// ----------------------------------------------------------------------------
// Saves a float into a lr variable, much like lr_save_int() saves an integer
//
// Parameters:
// value Float value to store
// param Loadrunner variable name
// decimals Number of decimals in the result string
//
// Returns:
// N/A
//
// Example:
// lr_save_float(123.456, "myVar", 2); // myVar = 123.46 (includes rounding)
//
// ----------------------------------------------------------------------------
{
char buf[64]; // if more>63 digits -> your problem <IMG class=wp-smiley alt=:) src="http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif">
char formatbuf[16]; // 16 chars should be adequate
sprintf( formatbuf, "%%.%df", decimals); // Build the "%?.f" format string
sprintf( buf, formatbuf, value); // sprintf the value
lr_save_string( buf, param); // store in variable
}
使用例子如下:
#include "lr_save_float.h"
vuser_init()
{
lr_save_float(123.456, "myVar", 2);
lr_output_message(lr_eval_string("{myVar}"));
return 0;
}
分享到:
相关推荐
可以通过它先将事务的状态读出写入一个自定义的变量中,根据变量的值来决定下一步的动作。 简要说明 语法:intweb_reg_save_param(constchar*ParamName,,LAST); 参数说明:ParamName:存放得到的动态内容的参数名称...
LR常用函数的应用 web_reg_save,lr_save_string,lr_eval_string等函数
HP_LoadRunner_12_Community_Edition_Additional_Components_T7177-15046文件分割成两个压缩包,必须凑齐两个才能解压缩使用: HP_LoadRunner_12_Community_Edition_T7177-15046.part2.rar ... HP_LoadRunner_12_...
Micro_Focus_LoadRunner_2022_Community_Edition_Additional_Components
这是我在使用LoadRunner过程中总结的,上传上来供需要的人使用,希望能对你有所帮助,(*^__^*) 嘻嘻…… 坚决支持资源共享
HP_LoadRunner_12_Community_Edition_Additional_Components_T7177-15046文件分割成两个压缩包,必须凑齐两个才能解压缩使用: HP_LoadRunner_12_Community_Edition_T7177-15046.part1.rar ... HP_LoadRunner_12_...
loadrunner12.60,Community_Edition_Micro_Focus_LoadRunner_1260_Community_Edition.zip.001
文件为百度网盘链接; 内容包含HP_loadRunner_12.02_Community_Edition_T7177安装包和汉化包; 文件总共大小:1,782,393,386 字节。
LoadRunner,是一种预测系统行为和性能的负载测试工具。通过以模拟上千万用户实施并发负载及实时性能监测的方式来确认和查找LoadRunner能够对整个企业架构进行测试。通过使用LoadRunner,企业能最大限度地缩短测试...
这是我自己在使用过程中整理下来的,欢迎大家下载查看,谢谢各位的支持
LoadRunner_2022 软件安装包(Micro_Focus_LoadRunner_2022_Community_Edition.exe),文件分割成两个压缩包,必须集齐两个文件后才能一起解压一起使用: LoadRunner_2022(LoadRunner_2022_Community_Edition.part...
LoadRunner_2022 软件安装包(Micro_Focus_LoadRunner_2022_Community_Edition.exe),文件分割成两个压缩包,必须集齐两个文件后才能一起解压一起使用: LoadRunner_2022(LoadRunner_2022_Community_Edition.part...
LoadRunner_2022_Community_Edition.exe 绝大多数软件性能测试使用该软件 功能非常强大
Windows 7 32位系统下安装LoadRunner11,并安装过patch1、patch2、patch3、patch4,支持IE9录制脚本;支持65000个并发用户数,使用VMware Workstation 9以上打开此虚拟机文件,仅用于学习研究性能测试之用,商业用途...
Windows 7 32位系统下安装LoadRunner11,并安装过patch1、patch2、patch3、patch4,支持IE9录制脚本;支持65000个并发用户数,使用VMware Workstation 9以上打开此虚拟机文件,仅用于学习研究性能测试之用,商业用途...
loadRunner中移动在LR中,C的变量和LR的参数是不一样的。任何C的变量都不能被LR的函数直接调用。应该用lr_eval_string来取值。比如{NewParam}(LR中参数化的变量)直接用这个引用是没有问题的。但是如果如下:Action...
Windows 7 32位系统下安装LoadRunner11,并安装过patch1、patch2、patch3、patch4,支持IE9录制脚本;支持65000个并发用户数,使用VMware Workstation 9以上打开此虚拟机文件,仅用于学习研究性能测试之用,商业用途...
Micro_Focus_LoadRunner_2022_Community_Edition_Language_Packs 2022最新版loadrunner语言包
LoadRunner_12.60_Community_Edition_Micro_Focus_LoadRunner_1260_Community_Edition.zip.004
LoadRunner_2022(Micro_Focus_LoadRunner_2022_Community_Edition_Language_Packs.exe),适用于Windows x86-64系统