Run, debug, terminate tests
Running tests directly in a file or folder
If your tests don't require any specific actions before start, and you don't want to configure additional options, such as code coverage, you can run them by using the following options:
Click the gutter icon next to the test or test suite/fixture.
The gutter icon changes depending on the state of your test:
The gutter icon marks new tests.
The gutter icon marks successful tests.
The gutter icon marks failed tests.
Running tests using the Run widget
Create a new test configuration or save a temporary one.
Use the Run widget on the main toolbar to select the configuration you want to run.
Click or press Shift+F10.
After CLion finishes running your tests, it shows the results in the Run tool window on the tab for that run configuration. For more information about analyzing test results, refer to Explore test results.
Stop tests
Use the following options on the Run toolbar of the tab for the run configuration:
Click or press Ctrl+F2 to terminate the process immediately.
Rerun tests
Rerun a single test
Right-click a test on the tab for the run configuration in the Run tool window and select Run 'test name'.
Rerun all tests in a session
Click on the Run toolbar or press Ctrl+F5 to rerun all tests in a session.
Rerun failed tests
Click on the Run toolbar to rerun only failed tests.
Hold Shift and click to choose whether you want to Run the tests again or Debug them.
You can configure the IDE to trigger tests that were ignored or not started during the previous test run together with failed tests. Click on the test results toolbar and enable the Include Non-Started Tests into Rerun Failed option.
Debug tests
In the editor, click the gutter on the line where you want to set a breakpoint.
Right-click the gutter icon next to the failed test and select Debug 'test name'.
Alternatively, use the context menu of the test in the Test runner window:
The test will rerun in debug mode. After that, the test will be suspended, allowing you to examine its current state.
You can step through the test to analyze its execution in detail.