We are excited to announce support for two iOS test frameworks that are very popular with app developers: OCUnit and XCTest. As of today, you can run your OCUnit and XCTest tests on our cloud of real, non-jailbroken iOS devices.
What is OCUnit/XCTest?
OCUnit is a testing framework from Sente that was first integrated into Xcode 2.1. XCTest was introduced in Xcode 5 as a replacement for OCUnit, but both frameworks are still supported in the latest version of Xcode. Both frameworks are very developer friendly. They not only allow for writing automated tests in Objective-C, but are also tightly integrated with the development environment. Setting up your tests in Xcode is easy and Apple’s documentation contains a quick guide for adding a new test target using Xcode’s Test Navigator.
KIF, Kiwi, and more
A number of popular frameworks and libraries have been built on top of OCUnit that make development and maintenance of tests even easier, and AppThwack supports all of them. Here is a short list of the most notable ones:
KIF – Keep It Functional, an integration test framework that leverages accessibility labels for UI automation of an app.
Kiwi – Behavior Driven Development (BDD) library for iOS.
Specta – Another BDD framework for Objective-C.
OCMock – An excellent library that implements Objective-C mock objects. Can be used in combination with any of the frameworks listed above.
Running OCUnit and XCTest on AppThwack
Running your existing tests on AppThwack is very straight forward and doesn’t require you to make any changes to your code or binaries. Simply build your project, upload the bundles via our UI or API, select some devices, and hit Go! Here is a quick step-by-step guide based on the KIF sample Calculator project:
1) Build your tests by selecting ‘Product’->’Build For’->’Testing’.
2) Locate your application and test bundles using ‘Show in Finder’.
3) Archive both bundles so they can be uploaded to AppThwack.
4) Go to your AppThwack iOS project, upload your application bundle ZIP file, select OCUnit and upload our test bundle ZIP, select devices and hit the the ‘Go’ button.
That’s it! Your tests are now running on AppThwack’s device cloud and you will see your results in a few minutes. Your AppThwack report will contain results for all of your tests as well as performance data for the devices that you selected. All of the test failures will be displayed in the highlights view:
Once you go into the results for a particular device, you will see detailed performance data, all test results, device console logs, and crash reports (if any):
You can see a complete sample report here.
Continuous Integration with AppThwack
1) Upload your app bundle ZIP file:
curl -X POST -u "<your_api_key>:" https://appthwack.com/api/file -F
"name=myApp.zip" -F "file=@<path_to_your_app_bundle_zip>"
2) Upload your test bundle ZIP file:
curl -X POST -u "<your_api_key>:" https://appthwack.com/api/file -F "name=myTests.zip" -F "file=@<path_to_your_test_bundle_zip>"
3) Schedule your tests:
curl -X POST -u "<your_api_key>:" https://appthwack.com/api/run -F "project=<your_project_id>" -F "name=<test_run_name>" -F "app=<app_upload_id>" -F "ocunit=<tests_upload_id>"
Support for OCUnit and XCTest in our AppThwack Jenkins plugin is coming soon too.