Child pages
  • JUnit Report Macro
Skip to end of metadata
Go to start of metadata

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.

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

Screenshot: The JUnit Report Macro in Confluence

(info) When generating reports from JUnit, set the Apache Ant formatter to 'XML'.

On this page:

Usage with the Macro Browser

To insert the JUnit report macro into a page using the Macro Browser,

  1. Open the Confluence page or blog post that you want to edit, then click the 'Edit' button.
  2. Click the Macro Browser icon on the toolbar. The macro browser window will open.
  3. Scroll through the list of macros to find the one you want. Alternatively, start typing the macro name into the search box at the top right of the macro browser. Macros with a matching name will appear in the main pane.
  4. Click the desired macro.
  5. Set the macro parameters to your requirements. If desired, you can preview these changes by clicking 'Refresh'.
  6. Click 'Insert' to add the macro onto the page.

(tick) You can also insert macros via autocomplete. For more information, see Using Autocomplete in the Rich Text Editor.

Once you've found the JUnit report macro, fill in the URL fields and click 'insert' to add it to your page.

Usage with the Wiki Markup Editor

To insert the JUnit report macro into a page using the Wiki Markup Editor,

Enter the junitreport code tags into your document as follows.



Parameters are options that you can include in Confluence macros to control the content or format of the macro output. The table below lists relevant parameters for this macro.

Parameter names are different in the macro browser and in wiki markup. Below we show the macro browser parameter names in bold text, and the equivalent wiki markup parameters in (bracketed) text. If we do not show any parameter name for the wiki markup, then you should leave out the parameter name and simply include the parameter value as the first parameter, immediately after the colon (:).




Directory (URL) of your test result files


URL of a directory containing your test result files.

Report Detail


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

URL of the test result XML file


URL of a particular test result XML file. 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.



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


Loading JUnit reports from a local drive


(warning) Must be a directory name and not the XML file itself.

Loading JUnit reports from a network drive


Loading JUnit reports from a Confluence instance

{junitreport:url=<page id>/file.xml}

Loading JUnit reports from a Confluence instance without anonymous user access

If your Confluence instance is not accessible by anonymous users, specify logon 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 "admin".

{junitreport:url=<page id>/file.xml?os_username=admin&os_password=admin}

If you use both the directory and url parameters in the same macro, the directory will be used and the url parameter ignored.


Working with Macros

Take me back to the Wikis Help Guide.

  • No labels