AppCode and Unit Tests

Vinay Ganesh
2 min readJul 29, 2016

--

XCode’s quality is deteriorating by the day with its instability. I am trying out AppCode these days and i feel its so much better. But for someone who has always worked on XCode, it is almost impossible to move to AppCode as it doesn’t look or feel the same as XCode. I have worked on different IDEs in my career starting from Visual Studio, PhpStorm, PyCharm, Android Studio, Eclipse and finally XCode for iOS development.

There are instances in XCode where the little diamond test buttons in XCode disappear and never show up even after restarting your computer let alone restarting XCode. Ever wondered why? Check out this blog post from me to get those back. This is one of the reasons why i wanted to try a new IDE for iOS development and here i am using AppCode.

Unlike XCode, AppCode doesn’t come with different targets configured. We will have to manually configure them. Follow these steps below and you will be good to go.

Click on “Edit Configurations” from “Select Run/Debug Configurations” Menu.

In the window that opens, click on the “+” on the left top which will bring up the menu shown above. Select XCTest/Kiwi option.

Give a name to your test target in the “Name” field. If you want to test a class or a method just select Class/Method for “Test Kind.” In the field for “Class” you can leave it blank to test all the classes in the test target or you can test a particular class. Once you type the test class’ name, the “Method” dropdown will show you all the tests in that particular class and you can choose to test even a single method of a class. This gives a very good flexibility. Set the “Target” to your test target in your project. Click on “Apply.” Now you will see a configuration for your tests target in the “Select Run/Debug Configurations” dropDown menu. Select the test target and a device and click on the “Run” button. Voila! your tests will start running.

AppCode version used while writing this post is 2016.1.2.

--

--