loadrunner Lr_类函数之 lr_error_message()
2018-01-03 23:12
666 查看
lr_error_message()
向输出窗口,日志文件和其他测试报告摘要发送带有位置详细信息的错误消息。int lr_error_message(const char *format,exp1,exp2,... expn。);
参数说明:
format C Language:要发送到“输出”窗口的格式化字符串。您可以在引号中指定文字字符串,或者使用可用于printf的标准消息格式化。
exp1,exp2,... expn C Language:要格式化的表达式或变量。
lr_error_message函数向产品输出窗口(例如LoadRunner输出窗口),日志文件(例如Vugen和应用程序管理代理日志文件)和其他测试报告摘要发送错误消息。有关每个产品的输出的详细信息,请参阅产品的用户指南。
要发送不是特定的错误消息的特殊通知,请使用lr_output_message。
If Run-time settings > General >Miscellaneous > Fail open transactions on lr_error_message is selected,calling lr_error_message will fail the transaction in addition to sending themessage. If you want to save the elapsed time in spite of the transactionfailure,
capture the time with lr_get_transaction_duration before callinglr_error_message, then create a transaction to report the time withlr_set_transaction.
(如果选择了lr_error_message上的运行时设置>常规>其他>故障打开事务,则除了发送消息之外,调用lr_error_message将会使事务失败。如果要尽管事务失败仍要保存耗用时间,请在调用lr_error_message之前使用lr_get_transaction_duration捕获时间,然后创建一个事务以使用lr_set_transaction报告时间。)
不建议在事务中间向Output窗口发送消息,因为它会延长执行时间。而应使用lr_log_message将消息仅发送到Vuser日志文件。这节省了发送消息所需的资源
VuGen使用错误代码17999以红色显示执行日志中lr_error_message函数的消息文本。请注意,即使在运行时设置中禁用日志记录时,此函数也会向输出发送一条消息。
在Vuser执行日志中,此函数列出发出消息的位置和行号。要发出没有这些详细信息的消息,请使用lr_message。
Output of lr_error_message("outputmessage"); - Action(4):output message
Output of lr_message("message");- message
示例:lr_error_message
在以下示例中,如果登录失败,lr_error_message将向LoadRunner输出窗口或应用程序管理代理日志文件发送消息:
int status = web_url("Login",
"URL=https://secure.computing.com//login.asp?user={username}&session={ssid}",
"RecContentType=text/html", LAST );
if (status == LR_FAIL) {
lr_error_message("Error: %s", "Unable to login to securecomputing");
return -1;
}
在下一个示例中,我们定义了一个名为<iteration>的参数,它报告测试的迭代次数。 lr_error_message函数向LoadRunner
Controller或应用程序管理管理中心发送一条消息,指示当前的迭代次数。
int status = web_url("Login",
"URL=https://secure.computing.com//login.asp?user={username}&session={ssid}",
"RecContentType=text/html", LAST );
if (status == LR_FAIL) {
lr_error_message( "Error at iteration #%s", lr_eval_string("{iteration}" ) );
return -1;
}
相关文章推荐
- loadrunner Lr_类函数之lr_debug_message()
- loadrunner Lr_类函数之lr_continue_on_error()
- loadrunner Lr_类函数之 lr_fail_trans_with_error()
- loadrunner Lr_类函数之 lr_save_searched_string()
- delphi SysErrorMessage 函数和系统错误信息表
- loadrunner Lr_类函数之 lr_save_string()
- delphi SysErrorMessage 函数和系统错误信息表
- LoadRunner lr_eval_string() 函数使用及LR中变量、参数的简单使用
- loadrunner Lr_类函数之 lr_param_increment()
- loadrunner Lr_类函数之 lr_save_var()
- SysErrorMessage函数获取系统错误信息
- loadRunner函数之lr_set_debug_message
- loadrunner Lr_类函数之 lr_param_sprintf()
- SysErrorMessage 函数和系统错误信息表
- loadrunner Lr_类函数之lr_abort()
- lr中的lr_output_message,Lr_debug_message,Lr_error_message,Lrd_stmt,Lrd_fetch函数
- loadrunner Lr_类函数之lr_param_unique()
- loadrunner Lr_类函数之lr_abort()
- loadrunner Lr_类函数之 lr_paramarr_idx()
- loadrunner Lr_类函数之lr_decrypt()