2019-09-10_01-06-55_JUnit Report Macro

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community


The JUnit Report macro is no longer supported

This macro will be removed in a future Confluence release. Find out more

The JUnit Report macro displays a summary of JUnit test results from a directory accessible by the Confluence server. JUnit is a unit testing framework which allows programmers to ensure that individual units of Java source code are functioning correctly.

For security reasons JUnit test result files can only be imported from a specified location in the Confluence server's file system.  We recommend administrators create a folder in their Confluence home directory, add the system property confluence.junit.report.directory and specify the location for JUnit test result files to be imported from. JUnit Test result files cannot be imported from the server until this system property is set.

The JUnit Report macro appears as shown in the screenshot below.

Screenshot: The JUnit Report macro in Confluence

Note:When generating reports from the JUnit Report macro, set the Apache Ant formatter to 'XML'.

Using the JUnit Report macro

To add the JUnit Report macro to a page:

  1. From the editor toolbar, choose Insert > Other Macros
  2. Find and select the required macro

Speed it up with autocomplete: Type and the beginning of the macro name, to see a list of suggested macros. In this example we're inserting the cheese macro.

To edit an existing macro: Click the macro placeholder and choose Edit. This will open the macro details, so you can edit the macro parameters.


Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).





URL of the test result XML file

Must include either the directory or the url parameter


URL of a particular test result XML file. Is overridden by the Directory (URL) of your test result files parameter if you use both.

Example, from a Confluence instance: http://yourConfluenceInstance.com/download/attachments/<page id>/file.xml

For Confluence installations without anonymous user access, you can specify logon credentials as part of this parameter in the form of URL parameters:

  • os_username — The username of a Confluence user with permission to access to the JUnit test results.
  • os_password — The password of the Confluence user specified in the os_username parameter.

Directory (URL) of your test result files

Must include either the directory or the url parameter


URL of a directory containing your test result files. This must be a directory name and not the XML file itself. Overrides the URL of the test result XML file parameter if you use both.

Example, file:///C:/TEMP/

Example, for a network drive: http://*host*/*path*

Report Detail



Detail for the report. Can be all, fixture, summary or failuresonly.



Shows the content of failures, as well as the error messages.

Wiki markup examples

This is useful when you want to add a macro outside the editor, for example as custom content in the sidebar, header or footer of a space.

Macro name: junitreport

Macro body: None.

Loading JUnit reports from a local drive:


Loading JUnit reports from a network drive:


Loading JUnit reports from a Confluence site:

{junitreport:url=http://yourConfluenceInstance.com/download/attachments/<page id>/file.xml}

Loading JUnit reports from a Confluence site that requires authentication:

If your Confluence site is not accessible by anonymous users, specify login credentials with the os_username and os_password URL parameters (as part of the macro's url parameter). In this case, we are specifying a username of 'admin' and a password of 'secret'.

{junitreport:url=http://yourConfluenceInstance.com/download/attachments/<page id>/file.xml?os_username=admin&os_password=secret}
Last modified on Sep 10, 2019

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.