[Expand]General Information/viewarticle/75299/
 [Expand]Using Help System/viewarticle/68624/
 [Expand]Getting Started Tutorial/viewarticle/73031/
 [Collapse]Using TestComplete/viewarticle/70372/
  [Expand]TestComplete User Interface, Projects and Settings/viewarticle/74317/
  [Expand]Creating, Recording and Running Tests/viewarticle/74604/
  [Collapse]Test Results/viewarticle/74393/
    About Test Log/viewarticle/74743/
   [Expand]Test Log Window/viewarticle/72723/
   [Expand]Viewing Test Results/viewarticle/71519/
   [Collapse]Working With Test Results/viewarticle/70454/
     Adding and Deleting Log Files/viewarticle/70887/
     Renaming Log Items and Adding Comments to Them/viewarticle/75292/
     Printing Test Results/viewarticle/68312/
    [Collapse]Exporting Test Results/viewarticle/74337/
      Exporting Test Results in TestComplete/viewarticle/70885/
      Viewing Exported Results/viewarticle/75745/
      Working With Exported Results/viewarticle/73461/
      Know Limitations/viewarticle/74326/
      Exported Results Structure/viewarticle/73133/
      Exporting Test Results to a PDF File/viewarticle/72126/
    [Expand]Archiving Test Results/viewarticle/68596/
     Sending Results via E-Mail/viewarticle/75422/
     Creating Issue Reports for Test Results/viewarticle/73851/
     Scripting Access to the Test Log Contents/viewarticle/68245/
   [Expand]Posting Messages, Images and Files to the Log/viewarticle/72654/
  [Expand]Enhancing Tests/viewarticle/69325/
  [Expand]Teamwork and Integration Into QA Process/viewarticle/71012/
  [Expand]Extending TestComplete/viewarticle/72159/
  [Expand]Automating TestComplete/viewarticle/74580/
  [Expand]Best Practices/viewarticle/70336/
 [Expand]Testing Types/viewarticle/71476/
 [Expand]Applications Testing/viewarticle/69187/
 [Expand]Working With Application Objects and Controls/viewarticle/72879/
 [Expand]Samples and Tutorials/viewarticle/71571/
 [Expand]Other Tools That Help You Test Better/viewarticle/68606/
 [Expand]TestComplete Licensing Guide/viewarticle/74980/
Updated: 9/22/2015 Applies To: TestComplete 11 Rating: PoorPoorPoorPoorPoor 1 vote(s) Click to rate: PoorNot badAverageGoodExcellent
Exporting Test Results

Exporting Test Results in TestComplete

After a test run is over, TestComplete generates a detailed log of test results. You can export the test results to view them outside of TestComplete.

Exporting Results From the Project Explorer

To export results from the Project Explorer panel:

  • Right-click the desired result set under the Project Log or Project Suite Log node in the Project Explorer and select Export to from the context menu. TestComplete will display the Choose Storage Type and Location dialog:

    Choose Storage Type and Location Dialog
  • In the Export results in XML format to box select the format in which the results will be exported. You can choose one of the following formats:

    • Unpacked Storage - This format is selected by default. In this case, TestComplete will export the results to HTML, XML, image and helper files, to the folder specified in the Folder edit field (this field is visible only if you are exporting to Unpacked Storage). It is recommended that you specify a folder that contains no other files (for example, to a new folder). In this case, it will be much easier to manage the files with exported data.

      The exported data will not be packed. The “main” file is index.htm. To view the exported results, open this file in your Internet browser.

    • Multipart Hypertext Storage - If you select this format, TestComplete will export the results to the .mht file specified in the File name edit box (it is only visible if you are exporting to Multipart Hypertext Storage). When you select this format, the Choose Location dialog will appear. In this dialog, type the file name and its location or select the desired file where results will be exported and click Save. The file name will appear in the File name edit box.

      After the results are exported to the .mht file, you can view this file in Internet Explorer or send it via e-mail to your co-worker. It is recommended to use Internet Explorer 7 or later.

    Note: If you do not need Visualizer images to be saved along with the exported results, or if you need to reduce the overall size of the exported files, clear the Save visualizer images check box. Otherwise, TestComplete will include all the visualizer images to the exported results, and they will take more space on your computer.

    The results are always exported in the XML format. If you select Unpacked Storage, TestComplete will also create a number of helper files to display the exported results in the Internet browser. If you use the Multipart Hypertext Storage format, all the files will be packed into a single .mht file, which makes it easier to view them and send them via e-mail. For information on the format of exported results, see Exported Results Structure.

    Note that .mht files cannot be secured. If you send them via e-mail, the recipient’s mail client may open these files in the Restricted sites mode and the files’ data may be displayed incorrectly. For more information on how to work around this problem, see Issue With Multipart Hypertext Files Sent via E-mail.

  • To export the results, press OK. Cancel will close the dialog without saving any changes.

Exporting Results From the Log Page

To export results from the log page to a file:

  • Right-click the desired result set under the Project Log or Project Suite Log node in the Project Explorer panel and select Open from the context menu. TestComplete will open the Log page with the results in the Workspace panel.

  • You can export the whole node with the test results or a single row/folder of the log.

    • To export the entire test log:

      right-click the desired node in the log tree and select Export to from the context menu, or choose the log tree item and click Export Test Results from the Log toolbar that is located above the tree:
      The Export to... Menu Item
    • To export a single row or folder: right-click the desired result row in the Log page and select Export Current Row from the context menu:

      Export Current Row Menu Item
  • TestComplete will display the Choose Storage Type and Location dialog. Further actions are the same as those described in the previous section: select the export format, specify the location and press OK.

To export test results from the log page to a .pdf file:

  • Right-click the desired result set under the Project Log or Project Suite Log node in the Project Explorer panel and select Open from the context menu. TestComplete will open the Log page with the results in the Workspace panel.

  • Right-click within the Test Log panel and select Print Preview from the ensuing context menu.

  • Click the Export To PDF button on the toolbar of the ensuing Print Preview form. Alternatively, select File | Export To PDF from the form's main menu.

  • The PDF Export Options dialog, where you can specify the desired options for the generated .pdf file, will open. If you want TestComplete to open the generated file right after the results have been exported to it, enable the Open After Export option.

Exporting Results From Tests

You can also export the entire test log from tests. To do that, call the SaveResultsAs method of the Log object:

Log.SaveResultsAs (FileName, LogFormat)

The LogFormat parameter holds an integer value that specifies the format of the exported results (XML, HTML or MHT). The FileName parameter specifies the name of the file that contains the exported results or the name of the folder that contains files with exported data. For more information, see the method description. The following example demonstrates how you can export test results to an .mht file from your script code:


Sub ExportResults
  FileName = Project.ConfigPath + "Log\MyResults.mht"
  Log.SaveResultsAs FileName, 2
End Sub


function ExportResults()
  var FileName;
  FileName = Project.ConfigPath + "Log\\MyResults.mht";
  Log.SaveResultsAs(FileName, 2);


def ExportResults():
  FileName = Project.ConfigPath + "Log\\MyResults.mht"
  Log.SaveResultsAs(FileName, 2)


procedure ExportResults;
var FileName : OleVariant;
  FileName := Project.ConfigPath + 'Log\MyResults.mht';
  Log.SaveResultsAs(FileName, 2);

C++Script, C#Script

function ExportResults()
  var FileName;
  FileName = Project["ConfigPath"] + "Log\\MyResults.mht";
  Log["SaveResultsAs"](FileName, 2);

If your project has several test items and you need to export test results to an external file, there is no need to call the SaveResultsAs method from each test item. You just need to call this method from the last test item. For example, you can create a special routine (see the sample code above) that will export test results and add it to the Test Items page as the last test item.

Another way to export the entire test log is to call the SaveResultsAs method from an OnStopTest event handler (see the example below).

Note that the event is triggered when the test run is over or when the execution of a project test item is over. So, if your project uses test items, in the event handler, you need to check whether the event is triggered for the last test item. To do this, use the Project.TestItems.Current property that provides a scripting interface to the currently executed test item. You can compare its name with the last item's name in your project and, if the comparison is successful, export the test results. The following code snippet demonstrates this.


Sub GeneralEvents_OnStopTest(Sender)
  ' Replace "TheLastTestItem" in the line below with the name of the last test item to run
  If Project.TestItems.Current.Name = "TheLastTestItem" Then
    Call Log.SaveResultsAs("C:\Results\", lsHTML)
  End If
End Sub


function GeneralEvents_OnStopTest(Sender)
  // Replace "TheLastTestItem" in the line below with the name of the last test item to run
  if (Project.TestItems.Current.Name = "TheLastTestItem")   
      Log.SaveResultsAs("C:\\Results\\", lsHTML);


def GeneralEvents_OnStopTest(Sender):
  # Replace "TheLastTestItem" in the line below with the name of the last test item to run
    if Project.TestItems.Current.Name == "TheLastTestItem":
      Log.SaveResultsAs("C:\\Results\\", lsHTML)


procedure GeneralEvents_OnStopTest(Sender);
  if (Project.TestItems.Current.Name = 'TheLastTestItem')  then
     Log.SaveResultsAs('C:\\Results\\', lsHTML);

C++Script, C#Script

function GeneralEvents_OnStopTest(Sender)
  // Replace "TheLastTestItem" in the line below with the name of the last test item to run
  if (Project["TestItems"]["Current"]["Name"] = "TheLastTestItem")   
      Log["SaveResultsAs"]("C:\\Results\\", lsHTML);

Exporting Results From the Command Line

To export results from TestComplete's command line, use the /exportlog command-line argument. It allows exporting test results either to the .mht or to the .tcLogX file.

A .mht file (archive) can be viewed in Internet Explorer. You can export test results to a .mht file from the command line, Project Explorer, test log or from your test. For more information on the mentioned approaches, see the sections above.

The .tcLogX format is an internal TestComplete file format corresponding to a single file (archive) that can be saved outside of TestComplete. Then, you can easily include this file in your project and view it from TestComplete as any other test log. To add a .tcLogX file to your project, right-click the Project_name Logs node in the Project Explorer panel and select Add | Existing Log File from the subsequent context menu. Then navigate to the created .tcLogX file using the standard Open File dialog and click Open. TestComplete will add the file to your project and you will be able to view it in the Test Log panel.

You can export test results to a .tcLogX file from TestComplete's command line only.

For more information on TestComplete command-line arguments, see TestComplete Command Line.

See also
Exporting Test Results | Viewing Exported Results | Exporting Test Results - Know Limitations | Printing Test Results | Sending Results via E-Mail

© 2015 SmartBear Software. All rights reserved.
Email Send feedback on this document