IntelliJ IDEA 2017.3 Help

Viewing and Exploring Test Results

On this page:

Overview

Depending on the selected node in the tree view of tests, the Test Runner displays information on the various levels. In the Test Runner, you can view statistics of the tests, navigate to stacktrace, show or hide successful tests, and more.

Use the Testing toolbar to control visual representation of the test results.

Viewing statistics

The Statistics tab shows information about the elapsed time and memory usage of each test.

To view statistics, click cogwheel blue with arrow on the Testing toolbar to reveal the drop-down menu, and then click the Show Statistics check command.

The values displayed in the Statistics tab are not accurate and only give an approximate estimate of the test performance. For example, if a garbage collector works during the test run, the memory usage shown in the Statistics tab is wrong.

Screenshot

Important note

If a unit test contains string assertEquals failures, the test runner provides the ability to view differences between the compared strings. Choose the View assertEquals Difference on the context menu of the failed test that contains assertEquals, and explore differences in the Differences viewer:

testFailStringAssertEquals

Viewing the results of previously run tests

The results of a test session can be saved in two ways:

  • Click exportToTextFile.png to have the results of the selected test saved in a file. In the Export Test Results that opens, specify the file to save the output in and the format in which the data will be saved. If you want to view the test results later, choose the XML format.
  • IntelliJ IDEA keeps track of test sessions and saves test results in its internal memory. Click ij_test_junit_import_test_results.png to view the test results that you previously saved in an XML file or the results that IntelliJ IDEA has kept in its internal history. The pop-up menu that opens shows a list of internally saved results of test sessions, each item is supplied with the name of the run configuration and a time stamp.
    ij test junit import test results pop up menu
    • To view the results of a testing session from the IntelliJ IDEA history, select the item with the suitable run configuration and time stamp.
    • To load the previously exported results, choose Import from file and then choose the required XML file in the dialog box that opens.
    The loaded test results are shown in the tab and the name of the corresponding run configuration is displayed on the title bar. To re-run the tests from the loaded session, click run/png.
Last modified: 6 March 2018

See Also

Reference: