博客导读网 |
一个让你随便看看的地方 |
web test LoadRunner Solar推荐天行健 - Lindows |
||
|
// lr_convert_string_encoding 在下列编码之间转换字符串编码:系统区域设置、Unicode 和 UTF-8。 // 该函数将结果字符串(包括其终止 // 结果字符串 NULL)保存在参数 paramName 中。 int lr_convert_string_encoding ( const char *sourceString, const char *fromEncoding, const char *toEncoding, const char *paramName); // lr_output_message 函数将带有脚本部分和行号的消息 // 发送到输出窗口和日志文件。 int lr_output_message (const char * format, exp1, exp2,...expn.); -- Sends a Vuser message to the log file and output window with location information. // lr_log_message -- Sends a message to the Vuser log file. // lr_message -- Sends a message to the log file and output window. // lr_save_string 函数将指定的以 null 终止的 // 字符串赋给参数。该函数可用于关联 // 查询。要确定参数值,请使用 // 函数 lr_eval_string。 int lr_save_string (const char *param_value, const char *param_name); // lr_eval_string 函数在评估任何嵌入的参数之后 // 返回输入字符串。如果字符串 // 实参 (argument) 只包含一个形参 (parameter),该函数 // 返回形参的当前值。 char * lr_eval_string (const char * instring );
HP LoadRunner Online Function Reference > C Language Functions > Example: strcpy // strcat 连接两个字符串。 char *strcat ( char *to, const char *from ); -- The following example uses strcat to append a backslash to the directory name, fullpath. It then appends filename to fullpath. // strcpy 将一个字符串复制给另一个。 char *strcpy ( char *dest, const char *source ); -- The following example uses strcpy to copy the string "c:\\tmp" to the character array fullpath. Action()
{
char fullpath[1024], *filename = "logfile.txt";
strcpy(fullpath, "c:\\tmp");
lr_output_message("fullpath after strcpy: %s", fullpath);
strcat(fullpath, "\\");
strcat(fullpath, filename);
lr_output_message("Full path of file is %s", fullpath);
lr_output_message( "We are on iteration #%s", lr_eval_string( "{iteration}" ) );
lr_log_message( "We are on iteration #%s", lr_eval_string( "{iteration}" ) );
lr_output_message("111");
lr_log_message("222");
lr_message("333");
return 0;
}
O
utput: ReplayLog: Virtual User Script started at : 2012-01-10 11:42:18
Action()
{
int i;
for(i=0;i<10;i++)
{
char tmp1[100];
lr_convert_string_encoding( lr_eval_string("{KeyWord}"),
LR_ENC_SYSTEM_LOCALE,
LR_ENC_UTF8,
"EncodedSearchTerm" );
strcpy( tmp1, lr_eval_string("{EncodedSearchTerm}") );
lr_save_string( tmp1, "sorvalue_book" );
web_url("SNGetKeywordCmd",
"URL=http://b2cpre.********.com/emall/SNGetKeywordCmd?keyWord={sorvalue_book}",
"Resource=0",
"RecContentType=text/html",
"Referer=http://b2cpre.********.com/",
"Snapshot=t4.inf",
"Mode=HTML",
LAST);
/*
...............................
*/
return 0;
}
}
LoadRunner lr_eval_string() 函数使用及LR中变量、参数的简单使用 http://blog.csdn.net/oobibigo/article/details/3321558 lr_eval_string() 函数的主要作用:返回脚本中的一个参数当前的值, 返回值类型:char 一般多用在调试脚本时输出参数的值.具体用法如下: lr_log_message(lr_eval_string("{parameter1}"))
1.参数的赋值和取值
lr_save_string("hello world","param"); end 已有 0 人发表留言,猛击->>这里<<-参与讨论 ITeye推荐 |
||
| 原文地址:http://lindows.iteye.com/blog/1338893 |
| © 2010 博客导读网 BlogABC.NET 本站所有内容皆由网友推荐而来,所有博文的版权归原作者所有,如有冒犯,请邮件告知。uncracker#gmail.com |