Log.AppendFolder

Creates a folder in the test log and activates this folder.(在Test Log中创建文件夹并激活该文件夹)

Declaration

Log.AppendFolder( Str, StrEx, Priority, Attr, OwnerFolderID) Parameters
Str[in]RequiredVariant
StrEx[in]OptionalVariantDefault value: Empty string
Priority[in]OptionalIntegerDefault value: pmNormal
Attr[in]OptionalA LogAttributes objectDefault value: Default attributes
OwnerFolderID[in]OptionalIntegerDefault value: -1
ResultInteger

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:

ConstantValueDescription
pmLowest100The lowest priority of the folder.
pmLower200The folder priority which is lower than normal.
pmNormal300The normal (default) priority of the folder.
pmHigher400The folder priority which is higher than normal.
pmHighest500The 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.Message("Message1")
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)

转载于:https://www.cnblogs.com/Tcorner/archive/2010/04/09/1708046.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值