AppCode 2021.1 Help

Create run/debug configurations for tests

You can run your tests using run/debug configurations, in the way similar to running ordinary applications.

Create a test configuration

  1. From the main menu, choose Run | Edit Configurations.

  2. Click Add New Configuration on the toolbar and select one of the available testing frameworks: Boost.Test, Catch, Google Test, or XCTest.
    Add a run/debug configuration for tests
  3. In the dialog that opens, you can change the following configurations:
    • In the Name field, change the name of the run/debug configuration. The default name includes the selected class/method and test target.

    • In the Test kind list, select the test scope:
      • Class/Method (Suite/Test for Boost.Test and Google Test and Tags/Test for Catch): specify a particular test class or method. In the Class field, enter the test class name. AppCode will suggest available classes as you type. Once a class is specified, you can select a necessary method from the Method field.
        Select test class and methods

        If no method/class is specified, AppCode will run all available classes/methods.

      • Pattern: specify a set of tests.

        For XCTest, in the Pattern field, type the list of tests in the following format: TestClass/testMethod,TestClass/testMethod…, for example:

        Test pattern

        You can create a run/debug configuration with a pre-selected pattern. To do this, run the necessary test classes ⌃⇧F10, in the Test Results tree, select the tests that you want to include in the pattern, and run them again:

        Run selected tests

        For the selected tests, AppCode will create a temporary run/debug configuration which you can edit and save.

        For C++ tests, use wildcards for specifying test patterns. For example, use this pattern to run all the test starting with Plus:

        using wildcards in test patterns

    • In the Target field, your test target is preselected. Change it if necessary.

    • In the Configuration field, you can select the configuration type — debug or release.

    • If necessary, specify working directory and add program arguments and environment variables in the corresponding fields.

    • In the Before run section, you can define whether you want to launch any external tool or another run/debug configuration before run.

Create a test configuration for a specific file

  1. In the Project tool window, right-click the desired file with test classes, and select Create 'All in <filename>'.

  2. In the Run/Debug Configuration dialog that opens, specify the configuration parameters and activities to perform before test execution. Apply the changes and close the dialog.

Create a test configuration for a specific class or method

  1. In the editor, open the file containing test classes.

  2. Right-click the class or method name and select Create 'All in <class name>'.

  3. In the Run/Debug Configuration dialog that opens, specify the configuration parameters and activities to perform before test execution. Apply the changes and close the dialog.

Last modified: 14 April 2021