Log Attributes Operation

Applies to TestComplete 14.71, last modified on April 22, 2021

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 in your keyword tests.

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

The Log Attributes operation was created with the script extensions technology.

You can explore the operation source code to learn how to implement new keyword test 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. 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

Example

Here are typical scenarios of using the Log Attributes operation:

By using the Last Operation result
  1. Add the Log Attributes operation to your keyword test.

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

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

    Specifying Log Attributes
  4. 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.

  5. 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.

Results of the Log Attributes operation
By using variables

To define the font settings once and then use them for several operations:

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

  2. Switch to the Test Steps page.

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

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

  5. 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.

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

See Also

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

Highlight search results