Speed up tests indexing
Test indexing is one of the most CPU- and time-consuming IDE procedures. To speed it up, you can use CLion's mechanism of detecting test scopes or create a test scope manually. Either way, after you have a test scope, only the files filtered by this scope will be processed during test indexation.
CLion can identify test files in your project and create a test scope automatically.
note
Automatic test detection works for CMake projects only.
Select Help | Find Action (CtrlShift0A) from the main menu and search for Create test scope:
CLion shows the result of test detection in a balloon:
Click View changes to open the viewer, where you can check the current pattern (if it was detected previously or configured manually) and the new one:
Click Apply new Test Scope. In the Scopes dialog that opens, you can check and adjust the automatically detected pattern:
Click Apply to save the changes.
CLion also opens the test scope creation report in the editor:
Go to Settings | Appearance & Behavior | Scopes.
Click the Add Scope button (
) and select what kind of scope you want to define: local or shared.
tip
Learn more about shared scopes in File scopes.
Set the following name for the new scope: Tests.
You can configure another name in Settings | Advanced Settings | Tests Indexing Task:
Specify the file- or folder-based pattern for the scope. CLion will highlight the matching files in the project tree pane:
Click Apply to save the Tests scope. From this point on, only the files defined by this scope will be indexed during the Indexing tests phase.
You can use the Tests scope to filter the Project view and quickly access the test files in your project:
![Tests scope in Project view Tests scope in Project view](https://resources.jetbrains.com/help/img/idea/2024.3/cl_testsscope_projectview.png)
Thanks for your feedback!