Creates a folder in the test log and activates this folder.(在Test Log中创建文件夹并激活该文件夹)
Declaration
Str | [in] | Required | Variant | |
StrEx | [in] | Optional | Variant | Default value: Empty string |
Priority | [in] | Optional | Integer | Default value: pmNormal |
Attr | [in] | Optional | A LogAttributes object |
Default value: Default attributes |
OwnerFolderID | [in] | Optional | Integer | Default value: -1 |
Result | Integer |
Description
The AppendFolder
method creates a new folder in the test log and activates it. Once activated, TestComplete can send all posted messages to this folder. The folder can hold messages of different types (they are posted by the Log.Error
, Log.Warning
, Log.Message
, Log.Event
, Log.Picture
, Log.File
and Log.Link
methods) as well as other folders.
Parameters
The method has the following parameters:
Str
Folder caption. This text will be added to the Message column of the Test Log. Str can hold data of any OLE-compatible type. If it cannot be converted to text, its value is ignored.
StrEx
Additional text to be displayed in the Remarks pane of the Test Log. StrEx can hold data of any type compatible with OLE. If it cannot be converted to text, its value is ignored.
Priority
Folder priority. You can use any integer number or any of the following constants:
Constant | Value | Description |
---|---|---|
pmLowest |
100 | The lowest priority of the folder. |
pmLower |
200 | The folder priority which is lower than normal. |
pmNormal |
300 | The normal (default) priority of the folder. |
pmHigher |
400 | The folder priority which is higher than normal. |
pmHighest |
500 | The highest priority of the folder. |
Attr
The font and color settings that will be applied to the newly created folder in the log. They are represented by a LogAttributes
object. If this parameter is omitted, default attributes will be applied.
OwnerFolderID
Identifier of the test log's folder where a new folder will be created as a subfolder. To get this identifier, use the CreateFolder
or AppendFolder
method (they will create the parent folder). If this parameter refers to a non-existent folder, is omitted or is set to -1 (the default value), the AppendFolder
method will either create the folder in the default folder of the test log or append it to the test log outside of any other folder (if the default folder is not set). The default folder is the folder that is currently at the top of the folder stack which is populated during the script run. To push a folder to or pop it out of this stack, use the PushLogFolder
or the PopLogFolder
method correspondingly.
Return Value
An integer value that represents the identifier of the newly created folder in the test log.
Remarks
The AppendFolder
method is similar to the CreateFolder
method. The difference between them is that CreateFolder
just creates a new folder, while AppendFolder
creates a folder and activates it, so you do not need to call PushLogFolder
after AppendFolder
.
Example
The following example creates a structure of folders and messages in the test log. This structure is shown in the image below.
VBScriptCopy Code
Log.Error("Error1")
Dim FolderID(2)
For i = 0 To 2
FolderID(i) = Log.CreateFolder("Folder" & i)
Log.PushLogFolder(FolderID(i))
Log.Warning("Warning" & i)
Next
Log.Event("Event1")
Log.PopLogFolder
Log.CreateFolder("Folder4")
Log.Link("www.oursite.com")
Log.PopLogFolder
Log.Message("Message2")
Call Log.CreateFolder("Folder5", , , , FolderID(2))
If you need to activate a log folder right after creating it, you can use the AppendFolder
method instead of the combination of CreateFolder
and PushLogFolder
. The following code snippet shows how this can be done in the example above:
FolderID(i) = Log.CreateFolder("Folder" & i)
Log.PushLogFolder(FolderID(i))
' is equal to
FolderID(i) = Log.AppendFolder("Folder" & i)