- http请求通过返回码进行校验。使用函数
注意loadrunner中变量定义必须放在最前面,否则会报错。HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
action{
int HttpRetCode;
web_url("login",
"URL=http://www.163.com",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
lr_output_message( "HTTP_INFO_RETURN_CODE %d",HttpRetCode);
//Check HttpRetCode
if (HttpRetCode == 200) {
lr_log_message("The script successfully accessed the login page");
}
else {
lr_log_message("The script failed to access the login page ");
}
}
通过跳转页面的内容进行校验。
使用web_reg_find函数。
遇到需要用中文校验时,有两种方法解决:一是设置录制时的格式为utf-8;二是通过lr_convert_string_encoding 函数转化需要校验的内容格式。
Action()
{
lr_start_transaction("tv