Skip to main content

JUnit

The JUnit plugin is essential for importing JUnit tests into ReportPortal.

The JUnit plugin is pre-installed automatically. However, if for any reason you have removed it, you can upload it again.

Upload plugin​

  1. Log in to ReportPortal as administrator.

  2. Go to Administrate -> Plugins section.

  3. Click ‘Upload’ button at the top of the page.

  4. Add .jar file and click ‘Upload’ button.

Launch import via UI with JUnit plugin​

important

JUnit plugin should be enabled.

  1. Log in to ReportPortal.

  2. Go to the Launches page.

  3. Click ‘Import’ button.

  4. Select ‘JUnit’ in the ‘Report type’ dropdown on the ‘Import launch’ modal window.

  5. Click the drag-and-drop area to add .xml or .zip file under 32MB.

  6. Click ‘Import’ button and then ‘OK’ button on the ‘Import launch’ modal window.

note

Make sure to select JUnit file for the 'JUnit' Report type.
If you attempt to upload a file of any other agent for the 'JUnit' Report type, an error will occur.

If files from the zip archive have formats other than XML, the system will skip them.

If the XML file is not in the JUnit structure, the system will interrupt the process of copying and mark the file in red. The reason is then shown on the tooltip when hovering the file in the pop-up window.

Launch import via API with JUnit plugin​

important

JUnit plugin should be enabled.

The endpoint POST /v1/plugin/{projectName}/junit/import allows importing a launch into the specified project using an XML or ZIP file.

You can configure parameters (name, description, attributes) for the imported launch by specifying these values in your API request.

There is the ability to read attributes and descriptions for Suite and Test level from XUnit reports while importing.

Description and attributes:

<properties>
<property name="description"> Lorem ipsum …</property>
<property name="attribute" value="Lorem:ipsum"/>
</properties>

Import JUnit test results to existing launch via API​

important

JUnit plugin should be enabled.

The endpoint POST /v1/plugin/{projectName}/{plugin}/import allows importing test results in XML or ZIP format into existing launch in any status. Meanwhile, import into a finished launch does not change the launch finish time.

note

Start time of imported tests can't be earlier than start time of original launch.

The template for launchImportRq object for your API request can be found in the API section -> Plugin : Plugins API collection -> POST /v1/plugin/{projectName}/{pluginName}/import

To import test results to an existing launch, you should specify launchUuid parameter in your API request.

info

Content Type for launchImportRq should be application/json.

You can easily find it in the UI on the "Edit Launch" modal.

Name, description, start time and attributes you can leave as is.

The imported values do not overwrite the existing launch attributes, name, or description.

Disable plugin​

  1. Log in to ReportPortal as administrator.

  2. Go to Administrate -> Plugins section -> Import Launches tab.

  3. Find JUnit plugin and click on it.

  4. Click toggle OFF.

Uninstall plugin​

  1. Log in to ReportPortal as administrator.

  2. Go to Administrate -> Plugins section -> Import Launches tab.

  3. Find JUnit plugin and click on it.

  4. Click ‘Uninstall’ button and confirm your choice.

Following these steps, you can easily import JUnit test results into ReportPortal for further analysis and enhanced test automation reporting capabilities.