Tools to Enrich Your Calabash Test Framework

I have tried out a couple test automation tools for mobile apps, but I still like Calabash the most. However, no matter how strong a tool is, it has limitations and it may not support everything you want, and Calabash is no exception.

I just finished a test automation project for iOS apps. Let me share with you what extra tools I used to enrich the Calabash test framework.

Use fruitstrap to install the app on the test device

Calabash does not support app installation on the device, so before you run your Calabash tests, you have to make sure that your app has been installed on the device. You could always deploy your build using XCode, but it would be ideal if you can skip this manual step for your automation project.

A tool I used is fruitstrap; it allows you to install an iOS app via USB. You can check out the source code from the fruitstrap GitHub page. There is a blog post that provides more instructions on building and using fruitstrap.

Record console log during test run with idevicesyslog

When you test the debug build of your mobile app, sometimes, you want to monitor the console log in order to see what is going on underneath the UI, especially when there are crashes or the test scenarios fail.

Currently, Calabash does not support reading the device console, so you could use idevicesyslog from the libimobiledevice library. One way to implement this in your framework is, in the Before hook, fork a thread to read the console using idevicesyslog and print it in a file. Then, in the After hook, terminate the thread.

Here is the libimobiledevice page. And there is a GitHub page for libimobiledevice on Mac OS which contains the compiled libraries.

Format Cucumber results

Cucumber supports multiple report formats. Without specifying a formatter, your results will be printed on screen. If you have a lot of test scenarios in your test suite, it is going to be painful to scroll through your terminal to spot the results.

The Cucumber Reports page details the available formats. If you choose HTML as the report format, the screenshots taken by the screenshot_embed method are embedded in the report. If you integrate Calabash with Jenkins, you have to generate a JSON report.

Uninstall the app from the device using ideviceinstaller

After execution of a test suite is complete, the next step is to clean up the environment (sometimes, we may want to do a clean-up between tests).

To uninstall your app from your device, you can use ideviceinstaller from the libimobiledevice library. In fact, you can use ideviceinstaller to install, archive and list apps in a device.


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *