Quick and Nimble
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.
Learn how to create Quick and Nimble tests from AppCode in the unit testing tutorial.
Install Quick and Nimble frameworks
You can use CocoaPods to install Quick and Nimble.
Make sure that the CocoaPods gem is installed.
Create a Podfile (
) or open an existing one ( ).Add the Quick and Nimble pods to your test target, for example:
target 'MyApplicationTests' do inherit! :search_paths pod 'Quick' pod 'Nimble' endFrom the main menu, select
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 Shift+F10/Shift+F9 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.
You can also create this configuration manually:
From the main menu, select
.In the dialog that opens, click on the toolbar or press Alt+Insert.
Select XCTest from the list of templates that opens.
If you need a particular test class or method to be selected, in the Class field, enter the test class name. AppCode will suggest available classes as you type.
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.
In the Target field, your test target is preselected. Change it if necessary.
Fill in other fields if necessary.