Szerkesztés

Megosztás a következőn keresztül:


WDTF Object Logging

WDTF Object Logging is a feature in WDTF that enables WDTF objects to write log messages to a common log file automatically. The name of the object logging file is called TestTextLog.log. WDTF Object logging has two key benefits. It simplifies test script authoring by using WDTF object methods to log the high level method call, the method's parameters, and the method's result. WDTF Object logging also improves diagnosability by providing a consistent mechanism for writing common log messages.

By default WDTF object logging is disabled. You enable object logging by calling the IWDTFConfig2::EnableObjectLogging method. After you enable logging, you can temporarily disable or re-enable it for specific actions or collections of actions by calling the methods IWDTFAction2::EnableObjectLogging, IWDTFAction2::DisableObjectLogging, IWDTFActions2::EnableObjectLogging, and IWDTFActions2::DisableObjectLogging.

The log messages that the WDTF writes to the log file have common patterns.

<OBJECT_NAME> : <TYPE> : - <METHOD_NAME>(<METHOD_PARAMS>) <Additional Info>
<OBJECT_NAME> : <TYPE> : Target: <DisplayName>

The following example shows the logging output for a call to DeviceDepot.Query("Volume::") when logging is enabled for an example system.

[ Output ]

WDTF_TARGETS    : INFO  :  - Query("Volume::")
WDTF_TARGETS    : INFO  :          Target: Generic volume
WDTF_TARGETS    : INFO  :          Target: Generic volume
WDTF_TARGETS    : INFO  :          Target: HL-DT-ST RW/DVD MU10N ATA Device
WDTF_TARGETS    : INFO  :          Target: Generic volume
WDTF_TARGETS    : INFO  :          Target: Generic volume
WDTF_TARGETS    : INFO  :          Target: Generic volume

If object logging is enabled, object error logging is enabled by default. Otherwise, error logging defaults to disabled. Like object logging, you can enable/disable error logging by calling the methods IWDTFConfig2::EnableObjectErrorLogging, IWDTFConfig2::DisableObjectErrorLogging, IWDTFAction2::EnableObjectErrorLogging, IWDTFAction2::DisableObjectErrorLogging, IWDTFActions2::EnableObjectErrorLogging, and IWDTFActions2::DisableObjectErrorLogging.

The log messages that the WDTF writes to the log file for error logging have the following patterns. Look for the keyword "ERROR" to jump to the first error in the log.

<OBJECT_NAME> : <TYPE> : - <METHOD_NAME>(<METHOD_PARAMS>) <Additional Info>
<OBJECT_NAME> : <TYPE> : Target: <DisplayName>
<OBJECT_NAME> : ERROR : Status: <ErrorString>

You still have the option to write a custom message to the log file by calling the IWDTFLog2::OutputInfo or IWDTFLog2::OutputError method.

For a list of the available objects, see WDTF Object Name tags.

WDTF Object Name tags
Enabling and Viewing WDTF Traces