调试消息函数lr_debug_message和lr_set_debug_message

上一篇 / 下一篇  2009-08-18 11:02:19 / 个人分类:LoadRunner

可以使用VuGen的用户界面添加调试消息或错误消息。对于调试消息,可以指

示文本消息的级别(只有当指定的级别与消息类匹配时才发出该消息)。使用

lr_set_debug_message可以设置消息类。

要插入调试函数,请执行下列操作:

1依次选择“插入”>“新建步骤”。将打开“添加步骤”对话框。

2选择“调试消息”步骤,然后单击“确定”。将打开“调试消息”对话框。

3选择消息级别:“简要”或“扩展日志”。如果选择了“扩展日志”,请指示要

记录的信息的类型:“参数替换”、“结果数据”或“完全跟踪”。

4在“消息文本”框中键入消息。

5单击“确定”插入消息并关闭对话框。lr_debug_message函数将插入到脚本的

当前点。

lr_debug_message基本用法

intlr_debug_message (unsignedintmessage_level, const char *format, ...);

message_level

One of theMercury\LoadRunner\bin\vuser_utils_FuncRef.chm::/Message_Log_Run_Time_Settings.html">Message Log Run-Time Settings.Disableddoes not apply.

format

A formatted string which is the message to be sent to the log file. You may use the standard Message Formattingthat is available forprintf.

Thelr_debug_messagefunction sends a debug message when the specified message level is active. If the specified message level is not active, a message is not issued. You can set the active message level to MSG_CLASS_BRIEF_LOG or MSG_CLASS_EXTENDED_LOG from the user interface or by using lr_set_debug_message. To determine the current level, use lr_get_debug_message.

Note that you can also specify multiple message levels with an OR separator ("|"). If any one of the levels are active (from the UI), the message is issued to the Output window. If none of the levels are active, the message is not issued.

The message is sent to the output window. To display the debug messages in the LoadRunner output window or Application Management agent log file, use the Expert Mode Settings. Activate Expert Mode (Tools>Expert Mode) and then chooseTools>Options>Debug Informationand select theGeneralcheck box.

例子:

In the following example,lr_debug_messageissues a message to the log when either the Parameters Substitution or Result Data classes are set.

lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON);

. . .

rc = lrd_fetch(Csr1, 1, 1, 0, PrintRow3);

if (rc>2000)

lr_debug_message(LR_MSG_CLASS_RESULT_DATA |         LR_MSG_CLASS_PARAMETERS, "Operation failed.");


TAG:

 

评分:0

我来说两句

Open Toolbar