slPacker Object

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The slPacker object is used to compress test results from your scripts. Its methods let you archive the current run’s test results, compress the desired file(s) of the test results, and so on.

Members

Example

The following script exports results to a collection of XML and helper image files and then compresses the exported data.

JavaScript, JScript

function PackResults()
{
  var WorkDir, FileName, FileList, ArchivePath;
  WorkDir = Project.ConfigPath + "Log\\ExportedResults\\";
  FileName = WorkDir + "MyFile.mht";
  Log.SaveResultsAs(FileName, 2);
  FileList = slPacker.GetFileListFromFolder(WorkDir);
  ArchivePath = WorkDir + "CompressedResults";
  if (slPacker.Pack(FileList, WorkDir, ArchivePath))
    Log.Message("Files compressed successfully.");
}

Python

def PackResults():
  WorkDir = Project.ConfigPath + "Log\\ExportedResults\\"
  FileName = WorkDir + "MyFile.mht"
  Log.SaveResultsAs(FileName, 2)
  FileList = slPacker.GetFileListFromFolder(WorkDir)
  ArchivePath = WorkDir + "CompressedResults"
  if (slPacker.Pack(FileList, WorkDir, ArchivePath)):
    Log.Message("Files compressed successfully.")

VBScript

Sub PackResults
  WorkDir = Project.ConfigPath + "Log\ExportedResults\"
  FileName = WorkDir + "MyFile.mht"
  Log.SaveResultsAs FileName, 2
  FileList = slPacker.GetFileListFromFolder(WorkDir)
  ArchivePath = WorkDir + "CompressedResults"
  If slPacker.Pack(FileList, WorkDir, ArchivePath) Then
    Log.Message "Files compressed successfully."
  End If
End Sub

DelphiScript

procedure PackResults;
var WorkDir, FileName, FileList, ArchivePath : OleVariant;
begin
  WorkDir := Project.ConfigPath + 'Log\ExportedResults\';
  FileName := WorkDir + 'MyFile.mht';
  Log.SaveResultsAs(FileName, 2);
  FileList := slPacker.GetFileListFromFolder(WorkDir);
  ArchivePath := WorkDir + 'CompressedResults';
  if slPacker.Pack(FileList, WorkDir, ArchivePath) then
    Log.Message('Files compressed successfully.');
end;

C++Script, C#Script

function PackResults()
{
  var WorkDir, FileName, FileList, ArchivePath;
  WorkDir = Project["ConfigPath"] + "Log\\ExportedResults\\";
  FileName = WorkDir + "MyFile.mht";
  Log["SaveResultsAs"](FileName, 2);
  FileList = slPacker["GetFileListFromFolder"](WorkDir);
  ArchivePath = WorkDir + "CompressedResults";
  if (slPacker["Pack"](FileList, WorkDir, ArchivePath))
    Log["Message"]("Files compressed successfully.");
}

See Also

Archiving Test Results
TestComplete Helper Objects

Highlight search results