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.");
【全文結束】
文章來源于領測軟件測試網 http://www.anti-gravitydesign.com/