Publish JUnit Results

JUnit test reports provide useful information about test results, such as historical test result trends, failure tracking, and so on.

If you use JUnit to run your application's test scripts, you can configure your job to publish JUnit test reports:

  1. Upload your application with test script files to the Git repository.

  2. Open the job’s configuration page.

  3. Click the After Build tab.

  4. From Add After Build Action, select JUnit Publisher.

  5. In Include JUnit XMLs, specify the path and names of XML files to include. You can use wildcards to specify multiple files:
    1. If you’re using Ant, you could specify the path as **/build/test-reports/*.xml.
    2. If you’re using Maven, you could specify the path as target/surefire-reports/*.xml.

    If you use this pattern, make sure that you don’t include any non-report files.

  6. In Exclude JUnit XMLs, specify the path and names of XML report files to exclude. You can use wildcards to specify multiple files.

  7. To see and retain the standard output and errors in the build log, select the Retain long standard output/error check box.

    If you don’t select the check box, the build log is saved, but the build executor truncates it to save space. If you select the check box, every log message is saved, but this might increase memory consumption and can slow the performance of the build executor.

  8. To combine all test results into a single table of results, select the Organize test output by parent location check box.

    If you use multiple browsers, the build executor will categorize the results by browser.

  9. To mark the build as failed when JUnit tests fail, select the Fail the build on fail tests check box.

  10. To archive videos and image files, select the Archive Media Files check box.

  11. Click Save.

After a build runs, you can view its test results.

View a Build's JUnit Test Results

See the Test Results page to examine a build's JUnit test results:

Action How To

View the last build's test results

  1. Open the job’s details page.

  2. Click Tests the Tests icon.

    The Test Results page displays, showing the metrics for the most recent run.

View a particular build's test results

  1. Open the job’s details or summary page.

  2. In the Build History list, click the build number.

  3. Click Tests the Tests icon.

View a test suite's details

On the Test Results page, click the All Tests toggle button. From the Suite Name, click the suite name.

The test suite details page is displayed.

View a test's details

Open the test suite details page and click the test name.

To view details of a failed test, on the Test Results page, click the All Failed Tests toggle button, and then click the test name.

View test results history

On the Test Results page, click View Test Results History.

If you configure the job to archive videos and image files:
  • Click Show Show to download the test image.

    Supported image formats include .png, .jpg, .gif, .tif, .tiff, .bmp, .ai, .psd, .svg, .img, .jpeg, .ico, .eps, and .ps.

  • Click Watch Watch to download the test video file.

    Supported video formats include .mp4, .mov, .avi, .webm, .flv, .mpg, .gif, .wmv, .rm, .asf, .swf, .avchd, and .m4v.

Access and Analyze Your JUnit Test Result History

Some notable changes have come to the Test result history pages. The Frequency column is new. It shows the number of passing results compared to the number of times the test has been run. In addition, the Order column's name was changed to Result History.

You can see the Test result history in three places:
  • In Failed tests

    Failed tests page showing test results

  • In the Test information listed in the suite

    Test Result page for the mytest suite

  • In the Test details page

    Test details page for the mytest.test-3 test case