Exporting Test Results

Applies to TestComplete 14.10, last modified on June 5, 2019

After each test run, TestComplete generates a test log and stores it to the Log subfolder of your project or project suite folder. To view these logs, you must have TestComplete installed on your computer.

To view test logs outside TestComplete (for example, on a computer where TestComplete is not installed), you can export them to an external file:

JUnit reports

You can export test results to a JUnit report:

Note: The generated JUnit report differs from the JUnit-style report that the TestComplete Test build step for Jenkins with the Generate JUnit-style report option (or the publishJUnitReports parameter) enabled generates.

From the TestComplete IDE

If you have a Summary report generated for your test run, you can export it to a JUnit report:

Note: To learn in which cases TestComplete generates Summary reports, see Summary Report.

  1. In the Project Explorer, locate the needed test result and open it.

  2. Open the Summary report.

  3. Click Export Summary as JUnit on the report toolbar:

    Exporting the Summary report to JUnit in TestComplete
  4. Specify the name and location of the file to create and click Save.

TestComplete will export the results of all test cases that the Summary report contains to the JUnit report. You can then parse the report or publish it by using any framework that is compatible with JUnit reports.

From the command line

To generate a JUnit report for any test run, use the /ExportSummary command line argument.

For example:

TestComplete.exe "C:\My Projects\MySuite.pjs" /run /p:MyProj /ExportSummary:"C:\TestLogs\report.xml"

If there are test cases specified for the run, TestComplete will export their results. If no test cases are specified, TestComplete will export the results of the executed tests. For example, if you run a script routine that is not marked as a test case, TestComplete will export the routine results.

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

MHT

You can export test results to a single MHT file that contains the web page and all accompanying files:

From TestComplete IDE
  1. In the Project Explorer, right-click the needed results under the Project Log or Project Suite Log node and then click Export to.

  2. The Choose Storage Type and Location dialog appears.

  3. In the Export results to drop-down list, select Multipart Hypertext Storage:

    Select Multipart Hypertext Storage to export TestComplete test results to MHT
  4. Specify the file name of the MHT file to create.

    Note:MHT files can be viewed in Internet Explorer (we recommend version 9 or later), but not Chrome or Firefox.

    If you send MHT files via email, the recipient may need to unblock the MHT file to view its contents. For details, see Issue With Multipart Hypertext Files Sent via E-mail.

  5. To include Test Visualizer images in the exported log, select Save Visualizer images.

    Note: These images take additional disk space.
  6. Click OK.

As an alternative, you can export the full log or a specific log node (for example, a test item log), or a single entry log:

  1. Double-click a log in the Project Explorer to open it.

  2. To export the entire log or a log tree node, right-click it in the Log Items tree and then click Export to:

    Exporting a partial log

    To export a single row or a folder, right-click it in the Test Log panel and then click Export Current Row from the context menu:

    Exporting the current log row
  3. The Choose Storage Type and Location dialog appears.

  4. In the Export results to drop-down list, select Multipart Hypertext Storage:

    Select Multipart Hypertext Storage to export TestComplete test results to MHT
  5. Specify the file name of the MHT file to create.

    Note:MHT files can be viewed in Internet Explorer (we recommend version 9 or later), but not Chrome or Firefox.

    If you send MHT files via email, the recipient may need to unblock the MHT file to view its contents. For details, see Issue With Multipart Hypertext Files Sent via E-mail.

  6. To include Test Visualizer images in the exported log, select Save Visualizer images.

    Note: These images take additional disk space.
  7. Click OK.

From tests

Use the Log.SaveResultsAs method:

JavaScript, JScript

Log.SaveResultsAs("C:\\Work\\Log.mht", lsMHT);

Python

Log.SaveResultsAs("C:\\Work\\Log.mht", lsMHT)

VBScript

Call Log.SaveResultsAs("C:\Work\Log.mht", lsMHT)

DelphiScript

Log.SaveResultsAs('C:\Work\Log.mht', lsMHT);

C++Script, C#Script

Log["SaveResultsAs"]("C:\\Work\\Log.mht", lsMHT);

The method will export the entire test log.

Note: If your project has several test items whose results you want to export, call Log.SaveResultsAs from the last test item only.
From command line

Use the /exportLog command-line argument:

TestComplete.exe "C:\My Projects\MySuite.pjs" /run /p:MyProj /exportLog:"C:\TestLogs\Log.mht"

TestComplete will export the entire test log to the specified file. For more information on TestComplete command-line arguments, see TestComplete Command Line.

HTML

You can export test results to an HTML page. The exported results will include images, scripts, styles, and helper data files that contain the results data:

From TestComplete IDE
  1. In the Project Explorer, right-click the needed results under the Project Log or Project Suite Log node and then click Export to.

  2. The Choose Storage Type and Location dialog appears.

  3. In the Export results to drop-down list, select HTML Files:

    Select HTML Files to export TestComplete test results to HTML
  4. Specify the folder to which exported test results will be placed. If the folder does not exist, it will be created.

  5. To include Test Visualizer images in the exported log, select Save Visualizer images.

    Note: These images take additional disk space.
  6. Click OK.

Another option is to export the full log or a specific log node (for example, a test item log), or a single entry log:

  1. Double-click a log in the Project Explorer to open it.

  2. To export the entire log or a log tree node, right-click it in the Log Items tree and then click Export to:

    Exporting a partial log

    To export a single row or a folder, right-click it in the Test Log panel and then click Export Current Row from the context menu:

    Exporting the current log row
  3. The Choose Storage Type and Location dialog appears.

  4. In the Export results to drop-down list, select HTML Files:

    Select HTML Files to export TestComplete test results to HTML
  5. Specify the folder to which exported test results will be placed. If the folder does not exist, it will be created.

  6. To include Test Visualizer images in the exported log, select Save Visualizer images.

    Note: These images take additional disk space.
  7. Click OK.

From tests

Use the Log.SaveResultsAs method:

JavaScript, JScript

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

Python

Log.SaveResultsAs("C:\\Work\\Log\\", lsHTML)

VBScript

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

DelphiScript

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

C++Script, C#Script

Log["SaveResultsAs"]("C:\\Work\\Log\\", lsHTML);

The method will export the entire test log.

Note: If your project has several test items whose results you want to export, call Log.SaveResultsAs from the last test item only.
From command line

Use the /exportLog command-line argument:

TestComplete.exe "C:\My Projects\MySuite.pjs" /run /p:MyProj /exportLog:"C:\TestLogs\Log.html"

Note:TestComplete also supports the .htm extension.

TestComplete will export the entire test log to the specified file. For more information on TestComplete command-line arguments, see TestComplete Command Line.

XML

You can also export test results to an XML format file from tests by using the Log.SaveResultsAs method:

JavaScript, JScript

Log.SaveResultsAs("C:\\Work\\Log\\Log.xml", lsXML);

Python

Log.SaveResultsAs("C:\\Work\\Log\\Log.xml", lsXML)

VBScript

Call Log.SaveResultsAs("C:\Work\Log\Log.xml", lsXML)

DelphiScript

Log.SaveResultsAs('C:\Work\Log\Log.xml', lsXML);

C++Script, C#Script

Log["SaveResultsAs"]("C:\\Work\\Log\\Log.xml", lsXML);

Notes:

  • You can specify either a fully-qualified path to the file that will contain test results or a folder path. When you specify the name of an external file, test results are saved to this file. Otherwise, TestComplete automatically creates the Description.tcLog file within the specified folder and saves test results to the created file.

  • If your project has several test items whose results you want to export, call Log.SaveResultsAs from the last test item only.

PDF

  1. Double-click a log in the Project Explorer to open it.

  2. Right-click within the Test Log panel and select Print Preview from the context menu. The Print Preview window appears.

  3. Click Export To PDF on the toolbar.

    – or –

    Select File > Export To PDF from the main menu of Print Preview.

  4. The PDF Export Options dialog appears, where you can specify PDF export options. If you want TestComplete to open the generated file right after the results have been exported to it, enable the Open After Export option.

tcLogX

You can export test results to a file of the .tcLogX format. It is a TestComplete internal file format which represents a single file (archive) that contains test log data.

You export test results to this format from by using the /exportLog command line parameter:

TestComplete.exe "C:\My Projects\MySuite.pjs" /run /p:MyProj /exportLog:"C:\TestLogs\Log.tcLogX"

To view results exported to the .tcLogX format, import them into a TestComplete project:

  1. Open a project in TestComplete.

  2. In the Project Explorer, right-click the <ProjectName> Logs node and select Add > Existing Log File.

  3. Browse for a .tcLogX file and click Open.

The log is added to your project and you can now view it in TestComplete.

See Also

Viewing Test Results in Web Browsers

Highlight search results