Archiving Results From Tests

Applies to TestComplete 14.71, last modified on April 22, 2021

Sometimes, the size of test results stored in a TestComplete project becomes too large, but you still need to keep all of these results for future use. To save disk space occupied by the test results, you can first compress them via an external archiving program, and then remove the original results from the disk.

You can compress a full test log into a ZIP archive from script tests by using the Log.SaveResultsAs method:

JavaScript, JScript

Log.SaveResultsAs("C:\\Work\\Log\\Log.zip", lsZip );

Python

Log.SaveResultsAs("C:\\Work\\Log\\Log.zip", lsZip )

VBScript

Call Log.SaveResultsAs("C:\Work\Log\Log.zip", lsZip )

DelphiScript

Log.SaveResultsAs('C:\Work\Log\Log.zip', lsZip );

C++Script, C#Script

Log["SaveResultsAs"]("C:\\Work\\Log\\Log.zip", lsZip );

Also, to archive test results and files from your tests, TestComplete provides the slPacker object. This object contains methods that let you compress test results and files of the current test run:

These methods require the packer configuration. For detailed information on how to set the configuration and pack files, see the following sections:

Configuring the Packer

Before you use the slPacker object to archive your files or test results, specify the packer configuration:

  • Open the Packer Options dialog. To do this, select Tools | Options from the TestComplete main menu and then select Engines | Packer in the ensuing Options dialog.

  • The Packer Options dialog contains a list of archiving utilities that can be used in TestComplete and a list of packer configurations. A configuration specifies which archiver is to be used for packing (or unpacking) and the parameters and command-line arguments that are passed to the archiver. Both, the list of archivers and the configurations can be customized. By default, TestComplete supports the following archiving tools:

    • ARJ32
    • RAR
    • WinZip
    • InternalZip

    To use the first three archivers, you need to specify the path to their executables. InternalZip means the zip functionality is built into TestComplete. To use it, no additional executables are needed.

    You can also add custom archivers and create new configurations for them. You can also modify existing configurations to make them fit your needs. For more information on this, see Packer Options Dialog.

    To use WinZip from TestComplete, the WinZip Command Line Support Add-On plugin should be installed in WinZip. You can download this add-on from http://www.winzip.com/prodpagecl.htm.

  • In the Script configuration box of this dialog, specify the configuration to be used by the methods of the slPacker object.

  • Press OK to save your change and close the dialog.

Packing From Tests

You can use the slPacker object from a script routine or keyword test.

You can pack test results and files from keyword tests in the following way:

  • You can add a sequence of keyword test operations to the test and call the slPacker methods in them. For instance, to pack the current test run’s results, add the Call Object Method operation to the test, select the spPacker.PackCurrentTest method and specify its parameter.

    For more information on how to implement common tasks in keyword tests, see Common Tasks for Keyword Test Operations. For more information on concrete methods’ parameters, see their description.

  • You can write a script routine, which will pack test results, and run it from a keyword test. For that purpose, add the Run This Routine operation to the test and specify the name of the created routine in the Operation Parameters wizard.

You can pack files from a script routine, for instance, within the OnStopTest event handler. Note that this event occurs each time any test comes to an end. For instance, this event will occur after a keyword test or a script routine has finished.

You can add test results packing to the OnStopTest event handler by placing this code in the handler routine:

JavaScript, JScript

function ProjectEvents1_OnStopTest(Sender)
{
  slPacker.PackCurrentTest("C:\\TestArchive\\New");
}

Python

def ProjectEvents1_OnStopTest(Sender):
  slPacker.PackCurrentTest("C:\\TestArchive\\New")

VBScript

Sub ProjectEvents1_OnStopTest(Sender)
  slPacker.PackCurrentTest "C:\TestArchive\New"
End Sub

DelphiScript

procedure ProjectEvents1_OnStopTest(Sender: OleVariant);
begin
  slPacker.PackCurrentTest('C:\TestArchive\New');
end;

C++Script, C#Script

function ProjectEvents1_OnStopTest(Sender)
{
  slPacker["PackCurrentTest"]("C:\\TestArchive\\New");
}

Now each time a test comes to an end, the current test run's results will be compressed in an archive.

Note: When creating a script or a keyword test that packs the test results, make sure that the resulting archive is not placed in the same folder where the log files to be packed are stored. Otherwise, during the next test run the name of the resulting archive will coincide with the name of one of the existing archive and an error will occur.

See Also

slPacker Object
Projects in TestComplete
Packer Options Dialog
Common Tasks for Keyword Test Operations

Highlight search results