MILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt; mso-hansi-font-family: 'Times New Roman'">可以使用 VuGen 的用户界面添加调试消息或错误消息。对于调试消息,可以指
示文本消息的级别(只有当指定的级别与消息类匹配时才发出该消息)。使用
lr_set_debug_message 可以设置消息类。
要插入调试函数,请执行下列操作:
1 依次选择“插入” > “新建步骤”。将打开“添加步骤”对话框。
2 选择“调试消息”步骤,然后单击“确定”。将打开“调试消息”对话框。
3 选择消息级别:“简要”或“扩展日志”。如果选择了“扩展日志”,请指示要
记录的信息的类型:“参数替换”、“结果数据”或“完全跟踪”。
4 在“消息文本”框中键入消息。
5 单击“确定”插入消息并关闭对话框。lr_debug_message 函数将插入到脚本的
当前点。
lr_debug_message基本用法
int lr_debug_message (unsigned int message_level, const char *format, ... );
One of the Mercury\LoadRunner\bin\vuser_utils_FuncRef.chm::/Message_Log_Run_Time_Settings.html">Message Log Run-Time Settings. Disabled does not apply. | |
A formatted string which is the message to be sent to the log file. You may use the standard Message Formatting that is available for printf. |
The lr_debug_message function 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 choose Tools > Options > Debug Information and select the General check box.
例子:
In the following example, lr_debug_message issues 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);
lr_debug_message(LR_MSG_CLASS_RESULT_DATA | LR_MSG_CLASS_PARAMETERS, "Operation failed.");
【全文结束】
文章来源于领测软件测试网 https://www.ltesting.net/