CLion 2017.1 Help

Test Runner Tab

In this section:

Basics

The Test Runner tab opens in the Run tool window when a testing session begins, and features the same toolbar buttons.

  1. The Run toolbar is almost the same as that for the Run tool window, but features testing-specific buttons.
  2. The left-hand pane shows the tree view of all tests within the current run/debug configuration.
    • The root node represents the test selected to run.
    • The nested nodes represent the hierarchy of test suites and test cases.
    • The leaf nodes represent the individual tests.

    The status of each test is indicated by an icon. Double-click a node to open the respective test class or test method in the editor.

  3. The testing toolbar provides controls that enable you to monitor the tests and analyze results. Some of the commands are duplicated on the context menus of the test tree nodes.
  4. The Output pane shows the output of the current test suit.
  5. The inline statistics show the list of executed tests with the execution time of each test.
  6. The color of the status bar indicates whether the tests have passed successfully. If at least one of the tests fails, the status bar turns red.

Run toolbar

ItemTooltip and ShortcutDescription
/help/img/idea/2017.1/run.pngRerun
Ctrl+F5
Click this button to rerun the current process.

The process reruns always in the same console regardless of whether this console is pinned or not.

/help/img/idea/2017.1/icon_toggleAutoTest.pngToggle auto-testIf this button is pressed, the autotest-like runner is turned on. It means that the test in the current run configuration tab will automatically rerun on changing its source code. Otherwise, to rerun such test, you have to click the rerun button /help/img/idea/2017.1/run.png.
/help/img/idea/2017.1/stop.gifStop
Ctrl+F2
Click this button to terminate the current process externally by means of the standard mechanisms.
/help/img/idea/2017.1/debug_layout.pngRestore LayoutClick this button to to have the changes to the current layout abandoned and return to the default state.
/help/img/idea/2017.1/pin.pngPinWhen this button is pressed, the current tab will not be overwritten; instead, the results of the next command will be displayed in a new tab.
/help/img/idea/2017.1/close.pngCtrl+Shift+F4Click this button to close the selected tab of the Run tool window and terminate the current process.
/help/img/idea/2017.1/help.pngF1Click this button to show reference.

Testing toolbar

ItemTooltip and ShortcutDescription
/help/img/idea/2017.1/testPassed.pngShow PassedClick this button to show tests that passed successfully.
/help/img/idea/2017.1/testIgnored.pngShow IgnoredClick this button to show the ignored tests in the tree view of all tests within the current run/debug configuration or test class.
/help/img/idea/2017.1/sortAlphabetically.pngSort alphabeticallyClick this button to sort tests in alphabetical order.
/help/img/idea/2017.1/sortByDuration.pngSort by durationClick this button to sort tests by duration.
/help/img/idea/2017.1/expandAll.png /help/img/idea/2017.1/collapseAll.png Expand All/Collapse All
Ctrl+NumPad Plus Ctrl+NumPad -
Click these buttons to have all nodes in the tree view of tests expanded.

These buttons are only available if the tested application contains more than test case.

/help/img/idea/2017.1/arrowUp.png/help/img/idea/2017.1/arrowDown.pngPrevious/Next Failed Test
Ctrl+Alt+Up/Ctrl+Alt+Down
Click these buttons to navigate between the failed tests.
/help/img/idea/2017.1/import_test_results.pngImport Test ResultsClick this button to view the test results that you previously saved in an XML file or the results that CLion 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.png
  • To view the results of a testing session from the CLion 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.
iconAction_blueClick this cog button to access the context menu with the following options:
  • Track Running Test: turn this option on to monitor execution of the current test. If a test suite contains multiple tests, the tree view of tests expands to show sequential test methods, as they are executed.
  • Show Inline Statistics: turn this option on to have the statistics shown next to a test result, displaying the time used for executing each test.
  • Scroll to Stacktrace: turn this option on to have the console scroll to the beginning of the trace of the last failed test.
    If you click the root node (the test package) in the tree view with this option turned off, the console will show the very beginning of the test.

    This option is helpful when a test package contains multiple test classes and test methods. If some of the tests fail, you can scroll in the console to the beginning of a stack trace of an exception or assertion.

  • Open Source at Exception: use this option to explore the results of a test that fails as an error, throwing an uncaught exception.
    If you double-click the failed test class or method in the tree view with this option turned on, the respective test class or method will open in the editor, with the caret placed at the line that caused the problem.
  • Autoscroll to Source: turn this option on to have the currently selected test in the tree view synchronized with the editor automatically.
  • Set Auto Test Delay: point to this node to reveal the list of available delays between file saving and rerunning tests. The selected value gets the check mark.
  • Select First Failed Test When Finished: turn this option on to have the first failed test automatically selected in the tree view upon completing the tests.

Test status icons

IconDescription
/help/img/idea/2017.1/testError.pngTest error. This status is assigned to tests that caused an exception from the tested source code.
/help/img/idea/2017.1/testFailed.pngTest failed. If at least one test receives this status, then all its parents are marked as failed.
/help/img/idea/2017.1/testIgnored.pngTest ignored.
/help/img/idea/2017.1/testInProgress1.pngTest in progress.
/help/img/idea/2017.1/testPassed.pngTest passed successfully.
/help/img/idea/2017.1/testTerminated.pngTest terminated. This status is assigned to tests that were cancelled by clicking the Stop button /help/img/idea/2017.1/stop.gif. If at least one test receives this status, then all unfinished tests and their parents are marked as terminated.

Output pane

This pane shows output of each test, generated at runtime, including all the messages sent to the output stream, and the error messages. The following table shows the toolbar buttons and context menu commands available for the Output pane.

ItemKeyboard ShortcutDescription
/help/img/idea/2017.1/arrowUp.pngUp the Stack Trace
Ctrl+Alt+Down
Click this button to navigate up in the stack trace and have the cursor jump to the corresponding location in the source code.
/help/img/idea/2017.1/arrowDown.pngDown the Stack Trace
Ctrl+Alt+Up
Click this button to navigate down in the stack trace and have the cursor jump to the corresponding location in the source code.
/help/img/idea/2017.1/icon_softWrap.pngUse Soft WrapsClick this button to toggle the soft wrap mode of the output.
scrollToEnd.pngScroll to the endClick this button to navigate to the bottom of the stack trace and have the cursor jump to the corresponding location in the source code.
print.pngPrintClick this button to configure printing out the console output in the Print dialog box that opens.
Clear AllChoose this item on the context menu to have all messages for the selected test deleted.
Copy ContentCtrl+CChoose this item on the context menu to have the current contents of the Output pane placed to the Clipboard.
Compare with ClipboardChoose this item on the context menu to invoke the Differences Viewer which shows the current contents of the Clipboard in the left-hand pane and the contents of the Output pane for the selected test in the right-hand pane.

Context menu commands

CommandKeyboard shortcutDescription

See Also

Last modified: 29 March 2017