Articles

[Collapse]TestComplete/viewarticle/63445/
 [Expand]General Information/viewarticle/63445/
 [Expand]Using Help System/viewarticle/55799/
 [Expand]Getting Started Tutorial/viewarticle/56246/
 [Collapse]Using TestComplete/viewarticle/57875/
  [Expand]TestComplete User Interface, Projects and Settings/viewarticle/57876/
  [Expand]Creating, Recording and Running Tests/viewarticle/56646/
  [Collapse]Test Results/viewarticle/55010/
    About Test Log/viewarticle/55125/
   [Expand]Test Log Window/viewarticle/56386/
   [Expand]Viewing Test Results/viewarticle/56369/
   [Collapse]Working With Test Results/viewarticle/56354/
     Adding and Deleting Log Files/viewarticle/56355/
     Renaming Log Items and Adding Comments to Them/viewarticle/55238/
     Printing Test Results/viewarticle/55097/
    [Expand]Exporting Test Results/viewarticle/55128/
    [Expand]Archiving Test Results/viewarticle/55322/
     Sending Results via E-Mail/viewarticle/56306/
     Creating Issue Reports for Test Results/viewarticle/55677/
     Scripting Access to the Test Log Contents/viewarticle/55140/
   [Expand]Posting Messages, Images and Files to the Log/viewarticle/55051/
  [Expand]Enhancing Tests/viewarticle/56964/
  [Expand]Teamwork and Integration Into QA Process/viewarticle/57266/
  [Expand]Extending TestComplete/viewarticle/57655/
  [Expand]Automating TestComplete/viewarticle/57438/
  [Expand]Best Practices/viewarticle/64008/
 [Expand]Testing Types/viewarticle/62721/
 [Expand]Applications Testing/viewarticle/62606/
 [Expand]Working With Application Objects and Controls/viewarticle/55815/
 [Expand]Samples and Tutorials/viewarticle/56239/
 [Expand]References/viewarticle/57878/
 [Expand]Other Tools That Help You Test Better/viewarticle/63442/
 [Expand]TestComplete 10 Licensing Guide/viewarticle/63451/
Updated: 9/23/2014 Applies To: TestComplete 10 Rating: GoodGoodGoodGoodGood 3 vote(s) Click to rate: PoorNot badAverageGoodExcellent
Working With Test Results

Exporting Test Results

TestComplete stores test results in XML format in the Log subfolder of your project or project suite folder. To view these results, you must have TestComplete installed on your computer. However, you can export results to a file (or files) and view them in your Internet browser. You can export results from tests or manually, by selecting certain menu items from the Log’s context menu.

Export 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.

Export 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:

VBScript

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

JScript

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

DelphiScript

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

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.

VBScript

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

JScript

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

DelphiScript

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

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.

Viewing Exported Results

After exporting the results, you can view them in your web browser. MHT files can only be viewed in Internet Explorer, so if you exported the results to a Multipart Hypertext Storage, you can only use Internet Explorer to view them. If you exported results to the Unpacked Storage, you can view them in any browser.

Viewing the results in a web browser is similar to viewing them in TestComplete’s test log. However, there are some differences, for instance, the exported results does not contain filter check boxes, they are filtered in another way. For information on this, see Viewing Test Results in Web Browsers.

Note for Google Chrome Users: By default, Google Chrome does not allow web pages that reside on a local computer to read other local files, so the exported test results may be displayed incorrectly by the browser or they may not be displayed at all. In order to use Google Chrome for viewing exported results, run it with the -allow-file-access-from-files command-line flag.

Two notes on viewing charts and graphs:

  • To view graphs and diagrams in exported results, install Adobe Flash Player 8.0 or later on your computer.
  • When trying to view charts and graphs that are exported with test results in the Internet browser, a data access problem may occur. To learn how to solve it, read the Issue With Graphs and Charts topic.

Creating Bug Reports From Test Results

Another feature that can help you in exporting and analyzing test results is sending bug reports to issue-tracking systems. You can easily create a bug report for the desired log item and send it to an issue-tracking system directly from the TestComplete test log. To learn more about sending bug reports from test results, see Creating Issue Reports for Test Results.

More Actions Over the Exported Results

Regardless of how you export results, you can pack the files containing the exported data and send them to your co-worker for review. For more information on this, see Sending Results via E-Mail.

If the results are too large, you can compress them and send the archive via e-mail. For more information on these actions, see Archiving Results From Tests and Sending E-Mail From Scripts.

Known Limitations

  • TestComplete allows posting links to files and resources to the test log using the Log.Link method. However, only links to HTTP resources can be exported. Links to resources of any other protocol, for example, HTTPS, MAILTO or FTP, are not exported and the Link column of the corresponding link messages are empty in the exported test log (however, the other data posted by the method is exported correctly).

    When you post a link to an HTTP resource to the test log, the resource’s address must have the protocol name specified, for example, http://www.smartbear.com. Otherwise, the link will not be exported and the Link column of the corresponding message will be empty in the exported test log.

See also
Viewing Test Results in Web Browsers | Exported Results Structure | Test Results | Printing Test Results | Sending Results via E-Mail | Archiving Results From Tests | Sending E-Mail From Scripts | Creating Issue Reports for Test Results


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