Log Attributes Operation

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

Use the Log Attributes operation to specify the font style and color for messages to be posted to the test log with the Log Message, Append Log Folder and Post Screenshot operations.

Operation Result

The operation returns a reference to the LogAttributes object that contains the font style and color settings.

Scripting Analogue

The operation performs the same actions as the CreateNewAttributes method of the Log object.

Child Operations

The operation cannot have child operations.

Operation Parameters

The operation has the following parameters:

Font, Background

Specifies the font color and the background color to be used to post messages to the test log.

Bold, Italic, Underline, StrikeOut

Specify the font attributes to be used to post messages to the test log.

Format

Specifies the format of the extended message to be displayed in the Details panel of the test log. Possible formats: HTML and Plain text.

Remarks

Here is a typical scenario of using the Log Attributes operation:

  • Add the operation to your keyword test.

  • Modify the operation’s properties to set the desired font style and color.

  • Add the Log Message (or Append Log Folder, or Post Screenshot) operation right after the Log Attributes operation.

  • Open the Operation Parameters dialog for the Log Message operation (or for the Append Log Folder or Post Screenshot operation) and specify [Last Operation Result] for the Attrib parameter:

    • Select this parameter in the dialog and click the ellipsis button in the Value column.

    • In the ensuing Edit Parameter dialog, choose [Last Operation Result] in the Mode combo box.

      Specifying the [Last Operation Result] value
    • Click OK to apply the changes and close the Edit Parameter dialog.

  • Click OK in the Operation Parameters dialog to save the changes and close the dialog.

Now the Log Message operation (or Append Log Folder, or Post Screenshot) will post messages that have the font style and color attributes specified by the Log Attributes operation. However, if you add one more Log Message operation, it will post messages that have default font and color attributes.

To define the font settings once and then use them for several operations, follow these steps:

  • Switch to the Variables page of the Keyword Test editor and create a new keyword test variable in it.

  • Switch to the Test Steps page.

  • Add the Log Attributes operation to your keyword test and modify its properties to specify the desired font and color settings.

  • Add the Set Variable Value operation to your test (this operation belongs to the Statements category).

  • In the Operation Parameters wizard select the keyword test variable that you have just created. Specify [Last Operation Result] as a new value of the selected variable. During test execution, TestComplete will save the LogAttributes object created by the Log Attributes operation to the variable.

  • Now use the variable to specify the Attrib parameter of any operation that posts messages to the test log.

Note that the Log Attributes operation was created with the script extensions technology. It is only available if the Log Attributes Keyword Test Operation script extension is installed and enabled in TestComplete.

The Log Attributes operation illustrates how you can use script extensions to extend the TestComplete functionality with new keyword testing operations. You can find the operation’s source code in the AQAScriptExtensions.tcx file that is located in the <TestComplete>\Bin\Extensions\ScriptExtensions folder. This file is a zip archive that has the .tcx extension. So, you can use any zip archiver to unpack files from it. For more information about the extension’s files, see Pre-Installed Script Extensions.

There is a tutorial that explains how this operation is created:

Creating Keyword Test Operations Tutorial

See Also

Logging Category
Log Message Operation
Append Log Folder Operation
Post Screenshot Operation

Highlight search results