Run, debug, terminate tests
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 a set of tests.
The
gutter icon marks new tests.
The
gutter icon marks successful tests.
The
gutter icon marks failed tests.
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 ShiftF10.
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.
Use the following options on the Run toolbar of the tab for the run configuration:
Click
or press CtrlF2 to terminate the process immediately.
Right-click a test on the tab for the run configuration in the Run tool window and select Run 'test name'.
Click
on the Run toolbar or press CtrlF5 to rerun all tests in a session.
Click
on the Run toolbar to rerun only failed tests.
Hold Shift and click
to choose whether you want to Run the failed 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 Run toolbar and enable the Include Non-Started Tests into Rerun Failed option.
tip
If you don't want the tests to rebuild on each rerun, select the test configuration in the Edit Configurations dialog and remove (
) Build from the Before launch block.
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.
Thanks for your feedback!