CLion 2024.3 Help

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.

Automatic test scope detection

CLion can identify test files in your project and create a test scope automatically.

  1. Select Help | Find Action (Ctrl+Shift+A) from the main menu and search for Create test scope:

    Create test scope in Find Action
  2. CLion shows the result of test detection in a balloon:

    Test scope detection result
  3. 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:

    Test file patterns diff viewer
  4. Click Apply new Test Scope. In the Scopes dialog that opens, you can check and adjust the automatically detected pattern:

    Automatically created test scope

    Click Apply to save the changes.

  5. CLion also opens the test scope creation report in the editor:

    Test scope creation report

Create a Tests scope manually

  1. Go to Settings | Appearance & Behavior | Scopes.

  2. Click the Add Scope button (the Add Scope button) and select what kind of scope you want to define: local or shared.

  3. Set the following name for the new scope: Tests.

    You can configure another name in Settings | Advanced Settings | Tests Indexing Task:

    Tests scope name
  4. Specify the file- or folder-based pattern for the scope. CLion will highlight the matching files in the project tree pane:

    The Tests scope
  5. 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
Last modified: 11 February 2024