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
Bold, Italic, Underline, StrikeOut
Format
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
-
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 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.
See Also
Logging Category
Log Message Operation
Append Log Folder Operation
Post Screenshot Operation