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
From the main menu, choose
.Click on the toolbar and select one of the available testing frameworks: Boost.Test, Catch, Google Test, or XCTest.
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.
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: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:
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
:
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
In the Project tool window, right-click the desired file with test classes, and select Create 'All in <filename>'.
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
In the editor, open the file containing test classes.
Right-click the class or method name and select Create 'All in <class name>'.
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.