Skip to content
  • There are no suggestions because the search field is empty.

JUnit XML

The JUnit XML integration lets you import automated test results from a wide range of automation tools into TestMonitor.

About JUnit XML

JUnit XML is a widely adopted standard for sharing test results, supported by most testing frameworks and CI tools. It works seamlessly with frameworks such as Cucumber, Jest, JUnit, PHPUnit, Robot Framework, xUnit.net, and many others.

Features

The JUnit integration supports:
  • Creating JUnit XML test cases, along with their associated results and execution run in TestMonitor.
  • Identification of previously uploaded JUnit XML test cases, enabling you to submit multiple execution runs over time.
  • Configuration of imported test case placement and milestone behavior.

Prerequisites

Before you begin, ensure you have:
  • Admin or project manager role in TestMonitor
  • One or more JUnit XML files ready to upload
  • NodeJS 18+ installed

When all these requirements are met, you can proceed with setting up the JUnit integration.

Activate the JUnit XML Integration

Activate the JUnit XML integration for your project as follows:

  1. Go to the Project Settings.
  2. Choose the Integrations option from the menu on the left.
  3. In the top right corner, click on Browse....
  4. Find and select the JUnit XML panel.
  5. Select the Activate button to enable the JUnit XML integration.
  6. Optionally, select the Default milestone for your JUnit XML test runs. Alternatively, specify the desired milestone directly in your CLI command.

Set Up the TestMonitor CLI

To upload your JUnit XML files, use the  TestMonitor CLI tool. Distributed as an NPM package, the CLI is straightforward to install and designed for cross-platform compatibility:

$ npm install -g @testmonitor/testmonitor-cli

This installs the tool globally once to use it across all your projects.

Submit a JUnit XML File to TestMonitor

Once installed, you can use the CLI tool to submit your JUnit XML file:

$ testmonitor-cli junit submit -d example.testmonitor.com -t token -f file.xml

Be sure to include the following required arguments:

  • Your TestMonitor domain (e.g., example.testmonitor.com)
  • Your JUnit XML integration token
  • The path to your JUnit XML file

Below are the available arguments and options for the JUnit upload command:

Option Description
-d, --domain TestMonitor domain (required)
-t, --token JUnit token (required)
-f, --file Path to JUnit XML file (required)
-a, --automation-type Test type (e.g. playwright, selenium)
-n, --name Custom test run name
-m, --milestone-id Target milestone ID
-o, --milestone-name Milestone name to find or create
-e, --test-environment-id Target test environment ID
-p, --preserve-names Preserve original test case names
-s, --skip-root-suite Skip root test suite nesting
-v, --verbose Output debug information

View and Analyze JUnit XML Results in TestMonitor

Once the results have been submitted, the CLI command will generate a URL that enables you to access and review the JUnit XML test results.

You can access a comprehensive overview of all JUnit XML test runs in the Track test runs section:

  1. Go to Track
  2. Open the filter dialog by clicking the icon.
  3. Identify and select the Reporter filter, then proceed to close the filter dialog.
  4. Activate the Reporter filter and select JUnit XML from the list.

Deactivate the JUnit XML Integration

If the integration is no longer required or your project comes to an end you can easily deactivate the integration:

  1. Go to the Project Settings.
  2. Choose the Integrations option from the menu on the left.
  3. Select the JUnit XML panel.
  4. In the top right corner, click on Deactivate... .
  5. Click Deactivate to confirm.

Deactivating the integration will halt the submission of any future automated tests.
All submitted test cases, test runs, and results will continue to be accessible within your project for your review and analysis.

Troubleshooting

If you encounter errors involving the JUnit XML integration with TestMonitor, here are some steps you can take to troubleshoot the issue:

Confirm your domain and token are correct

Ensure your TestMonitor CLI command includes the correct domain and token from your integration settings.

Ensure your Import folder and milestone settings are valid

Before submitting test runs, it is essential to establish and configure a milestone within your TestMonitor integration. You have the option to set a milestone directly through the integration configuration or to specify the milestone ID in your CLI command arguments.

Inspect the integration log

The integration log assists in identifying the reasons for integration failures by listing all encountered issues while interacting with JUnit XML. To access the log, follow these instructions:

  1. Open the integration page
  2. Click on the link in the right panel that reports the number of integration issues.

Investigate the log entry by reviewing the error type and description. You can dismiss the error by clicking on the check button on the right.

Refresh your integration token

If you continue to experience authentication errors, it is advisable to refresh your integration token to confirm that you are using the correct credentials.

  1. Click on the three-dotted menu in the top-right corner.
  2. Select Refresh token...
  3. Confirm your action.
  4. Ensure that you revise your TestMonitor CLI command to use the updated token.

Contact support

If these solutions do not resolve your issue, feel free to reach out to our support team for additional assistance.