Tips & Tricks

Unit testing with AppCode 3.0 – be more productive with less effort

Hello everyone,

Today we would like to tell you more about a bunch of changes we’ve done to simplify unit testing in AppCode. We’ll assume you’ve read our post about run configurations and if you are particularly interested in running tests you can have a look at our previous post about unit testing.

The main goal of the TDD improvements in 3.0 EAP was to simplify the whole workflow. First of all, you don’t have to switch to Xcode anymore if your project doesn’t have unit tests yet: an appropriate Unit testing target can be configured in AppCode. For this open Project Settings (Cmd+;) and press Cmd+N to add target.

Second, AppCode’s well-known generation feature (Cmd+N) has become a bit smarter and now assists you with test cases. Use it to create setUp/tearDown methods or test methods for OCUnit, XCTest or Google Test:
unittestsGenerateR
it, context, beforeEach, afterEach and specify blocks for Kiwi:
KiwiGenerationR
To offer more for Kiwi, we’ve also added a kiwi live template that generates Kiwi Spec:
kiwi_test

For Google Test there are a variety of TEST macros: TEST(), TEST_F(), TEST_P(), TYPED_TEST(), TYPED_TEST_P(). Now you can simply generate a TEST() one and after you specify a suite name, AppCode 3.0 will change the macro to the correct one automatically.

And last but not least, test run configurations are now synchronized with Xcode’s schemes. All changes in them are propagated automatically.
By the way, completion is now working for test run-configurations as well:
UnitTestsComplR

See some of these new features in action in this short demo:


Stay tuned!
The AppCode Team