AppCode 2019.2 Help

Quick

Quick is an XCTest-based testing framework for Swift and Objective-C. It provides convenient and straightforward way to write unit tests. In Quick, the whole test is defined in the spec() function which consists of three sections: describe, context, and it. Quick comes together with Nimble — a framework that provides matching and assertion functions.

In AppCode, you can run and debug Quick tests, create Quick-specific run/debug configurations, navigate between test cases and their source code, view and export test results.

Install Quick and Nimble frameworks

You can use CocoaPods to install Quick and Nimble.

  1. Make sure that the CocoaPods gem is installed.

  2. Create a Podfile (Tools | CocoaPods | Create Podfile) or open an existing one (Tools | CocoaPods | Edit Podfile).

  3. Add the Quick and Nimble pods to your test target, for example:

    target 'MyApplicationTests' do inherit! :search_paths pod 'Quick' pod 'Nimble' end

  4. From the main menu, select Tools | CocoaPods | Install to install the pods.

After you installed the frameworks, add a test class to your test target and write code for the test cases. Refer to Quick documentation for more information.

Create a run/debug configuration for Quick test

When you run/debug a test case with the ⌃R/⌃D shortcuts or by clicking the gutter icons in the editor, AppCode creates a temporary configuration automatically. You can edit and save this configuration later on if necessary.

Run/debug configuration selector

You can also create this configuration manually:

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

  2. In the dialog that opens, click the Add button on the toolbar or press ⌘N.

  3. Select XCTest from the list of templates that opens.

  4. If you need a particular test class or method to be selected, in the Class field, enter the test class name. AppCode will suggest you available classes as you type.
    Test class name
    When a class is selected, you can start typing the name of the method of this class in the Method field and choose one from the suggested variants.

    Leave Class and Method fields empty to have all classes and methods selected.

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

  6. Fill in other fields if necessary.

Last modified: 10 October 2019