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.
The operation returns a reference to the
LogAttributes object that contains the font style and color settings.
The operation cannot have child operations.
The operation has the following parameters:
Bold, Italic, Underline, StrikeOut
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:
Here are typical scenarios of using the Log Attributes operation:
By using the Last Operation result
Add the Log Attributes 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.
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.
By using variables
To define the font settings once and then use them for several operations:
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.
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
LogAttributesobject 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.