Boost.Test is one of the most popular testing frameworks for C++ development. Boost.Test support in AppCode includes:
Special Boost.Test Run/Debug configurations
Built-in test runner with the progress bar and a tree view of all the tests running
Ability to re-run failed tests, export test results, open previously saved results
Ability to navigate to the source code of a particular test
Getting started with Boost.Test
To use the Boost.Test framework in your projects, do the following:
Creating a Boost.Test Run/Debug configuration
Though you can simply run the Boost.Test target from your project as an ordinary configuration in AppCode, to take advantage of the built-in test runner, create specific Boost.Test configuration (one or more). For every target it can be done automatically when you run a test/set of tests, or explicitly.
Important note: AppCode supports Boost.Test version from 1.55 and higher, but if you are using the version lower than 1.62 you can find the "Test framework quit unexpectedly" warning message in the Run tool window, instead of expected test result tree view. In this case you need to specify the following string in the Program arguments field of Run/Debug configurations dialog:
In the editor, place caret on any line of a test code and run the test from the context menu or by pressing ⌃⇧R. AppCode creates the related run/debug configuration automatically, as in example: You can rerun it later, when needed.
In the project view, select a test source file (you can also place the caret in that file code in the editor or on a suite name). In the context menu, select Run All in ... or press ⌃⇧R to run the test. AppCode automatically creates and saves the following configuration, which you can reuse later:
To create the Boost.Test run/debug configuration manually, do the following:
- In the main menu, select
. In the dialog that opens:
Click on the toolbar or press ⌘N. Select Boost.Test from the list.
- For the new Boost.Test run/debug configuration:
Specify its name in the Name text box. This name will be shown in the list of the available run/debug configurations.
Select the Suite/Test radio button to run a particular or all the tests of a suite. Select Pattern radio button to run all the tests of a particular pattern.
Specify the suite name in the suite text box. Note, that this option is available only when the Suite/Test radio button is selected.
Select the desired test from the Test drop down list. Note, that this option is available only when the Suite/Test radio button is selected.
Specify the pattern name in the Pattern text box. Note, that this option is available only when the Pattern radio button is selected.
In the Target field, select the desired target from the list of available targets.
Specify common run/debug configuration parameters.
Apply the changes and close the dialog box.
To update an existing configuration:
In the main menu, select . In the dialog that opens:
Expand the Boost.Test node and select the desired configuration.
Update the required fields and apply changes.