Log.PopLogFolder Method

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

The PopLogFolder method pops the top folder of the folder stack out of that stack. Once this is done, the folder that follows the popped out folder becomes the top folder of the stack. The top folder is the default one. This means that by default, the Log.CreateFolder method will create new folders in it and all the messages posted by the Log.Error, Log.Warning, Log.Message, Log.Event, Log.Picture, Log.File and Log.Link methods will be placed in that folder. To push the needed folder to the top of the folder stack, call the PushLogFolder method.

Declaration

Log.PopLogFolder()

Result None

Applies To

The method is applied to the following object:

Result Value

None.

Example

The following example creates a structure of folders and messages in the test log. This structure is shown in the image below.

JavaScript, JScript

var FolderID = new Array(3);
Log.Message("Message1");
Log.Error("Error1");
for (var i = 0; i < 3; i++)
{
  FolderID[i] = Log.CreateFolder("Folder" + i);
  Log.PushLogFolder(FolderID[i]);
  Log.Warning("Warning" + i);
}
Log.Event("Event1");
Log.PopLogFolder();
Log.CreateFolder("Folder4");
Log.Link("www.oursite.com");
Log.PopLogFolder();
Log.Message("Message2");
Log.CreateFolder("Folder5", "", pmHigher, Log.CreateNewAttributes(), FolderID[2]);

Python

FolderID = []
Log.Message("Message1")
Log.Error("Error1")
for i in range(0, 3):
  FolderID.append(Log.CreateFolder("Folder" + str(i)))
  Log.PushLogFolder(FolderID[i])
  Log.Warning("Warning" + str(i))
Log.Event("Event1")
Log.PopLogFolder()
Log.CreateFolder("Folder4")
Log.Link("www.oursite.com")
Log.PopLogFolder()
Log.Message("Message2")
Log.CreateFolder("Folder5", "", pmHigher, Log.CreateNewAttributes(), FolderID[2])

VBScript

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))

DelphiScript

var
  i;
  FolderID : array[0..2];
begin
  Log.Message('Message1');
  Log.Error('Error1');
  for i := 0 to 2 do
  begin
    FolderID[i] := Log.CreateFolder('Folder' + aqConvert.VarToStr(i));
    Log.PushLogFolder(FolderID[i]);
    Log.Warning('Warning' + aqConvert.VarToStr(i));
  end;
  Log.Event('Event1');
  Log.PopLogFolder;
  Log.CreateFolder('Folder4');
  Log.Link('www.oursite.com');
  Log.PopLogFolder;
  Log.Message('Message2');
  Log.CreateFolder('Folder5', '', pmHigher, Log.CreateNewAttributes, FolderID[2]);
end;

C++Script, C#Script

var FolderID = new Array(3);
Log["Message"]("Message1");
Log["Error"]("Error1");
for (var i = 0; i < 3; i++){
  FolderID[i] = Log["CreateFolder"]("Folder" + i);
  Log["PushLogFolder"](FolderID[i]);
  Log["Warning"]("Warning" + i);
}
Log["Event"]("Event1");
Log["PopLogFolder"]();
Log["CreateFolder"]("Folder4");
Log["Link"]("www.oursite.com");
Log["PopLogFolder"]();
Log["Message"]("Message2");
Log["CreateFolder"]("Folder5", "", pmHigher, Log["CreateNewAttributes"](), 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:

JavaScript, JScript

FolderID[i] = Log.CreateFolder("Folder" + i);
Log.PushLogFolder(FolderID[i]);
// is equal to
FolderID[i] = Log.AppendFolder("Folder" + i);

Python

FolderID.append(Log.CreateFolder("Folder" + str(i)))
Log.PushLogFolder(FolderID[i])
# is equal to
FolderID.append(Log.AppendFolder("Folder" + str(i)))

VBScript

FolderID(i) = Log.CreateFolder("Folder" & i)
Log.PushLogFolder(FolderID(i))
' is equal to
FolderID(i) = Log.AppendFolder("Folder" & i)

DelphiScript

FolderID[i] := Log.CreateFolder('Folder' + aqConvert.VarToStr(i));
Log.PushLogFolder(FolderID[i]);
// is equal to
FolderID[i] := Log.AppendFolder("Folder" + aqConvert.VarToStr(i));

C++Script, C#Script

FolderID[i] = Log["CreateFolder"]("Folder" + i);
Log["PushLogFolder"](FolderID[i]);
// is equal to
FolderID[i] = Log["AppendFolder"]("Folder" + i);

See Also

Test Results
Using Folders
CreateFolder Method
AppendFolder Method
PushLogFolder Method
Error Method
Warning Method
Message Method
Event Method
Picture Method
File Method
Link Method

Highlight search results