Generally, CLion runs and debugs tests in the same way as other applications, by running the Run/debug configurations you have created. When doing so, it passes the specified test classes or methods to the test runner.
The tests run in the background, so you can execute several tests at the same time.
Run or debug a test
To start running or debugging a test, you can use the main toolbar or a context menu in the Project tool window or in the editor:
Use the main toolbar:
Select the necessary run/debug configuration from the list on the main toolbar.
Press Alt+Shift+F10 to see the list of available run configurations or Alt+Shift+F9 for debug configurations.
Click Run or Debug to the right of the list. Alternatively, select Shift+F10 or Shift+F9 from the main menu.
Use a context menu:
Right-click a test class in the Project tool window or open it in the editor, and right-click the background. From the context menu, select Run <class name> or Debug....
To run/debug a unit test, you can also use the gutter icons. Click icon to run a single test, or icon to run all tests from the suite (fixture, in case of Google Test) :
Note: following the first run of a test, the gutter icons indicate the test state: success ( icon) or failed ( icon), as in below example:
You can repeat your test session, or individual tests without leaving your test runner tab of the Run tool window. The tests are performed again using the same run configuration as in the initial run.
Rerun a testing session
Press Ctrl+F5 or click on the toolbar of the Test Runner tab.
Rerun an individual test
In the Test Runner tab, click a test case node or a test and select on its context menu.
Rerun failed tests
In the Test Runner tab, click on the toolbar.
Debug a failed test
In the Test Runner tab, press Shift and click Rerun Failed Tests .
Select Debug from the Restart Failed Tests popup.
The tests that have failed will rerun in the debug mode.
You can abort a test session at any point, and all the tests that are currently running will stop immediately.
To stop a test session, click the stop button on the toolbar of the test runner, or press Ctrl+F2.