Search This Blog

Tuesday, December 8, 2015

Automated acceptance tests in Calabash

The Mobilengers team at StxNext has recently moved to Calabash as our automated acceptance testing framework. All tests are written in Gherkin - simple, descriptive language that Cucumber can understand. Gherkin gives the ability to describe the desired behaviour in plain text preserving the possibility to run such a test on real devices. It serves two purposes - as a documentation tool and as automated tests framework. It has been translated to over 60 spoken languages (with leading English) so that your team can use the keywords in their own language.

Automated tests follow two simple conventions - that source file should be saved as .feature and that one source file should only contain description of a single feature.

Calabash is the mobile implementation of Cucumber. It enables native apps testing and is cross-platform - Android/iOS. It’s also open-source with all the code available freely on GitHub.

With Calabash we’re able to implement simple gestures (like - swipe down, button-clicks, go back etc.), make assertions concerning displayed content as well as take screenshots whenever something goes wrong in the app.

Running tests in the cloud on the real devices gives us the possibility to cover more devices without buying every phone available on the market. We use Amazon AWS Device Farm which has the possibility to run Calabash tests and covers most popular device models. It also gives detailed tests results, takes screenshots as well as pinpoints references to lines of source code where specific errors have originated from. AWS has the option to test apps in different device locales, GPS locations and specific “other apps” dependencies.

Simple tutorial on how to install Calabash (OsX/Ubuntu) and run basic tests can be downloaded here.




Reference:
https://github.com/kosiara/calabash-android-example-projects
https://github.com/calabash/calabash-android
https://github.com/calabash/calabash-ios
https://cucumber.io/
https://github.com/cucumber/cucumber/wiki/Gherkin
http://www.slideshare.net/Codemotion/calabash-codemotion-2012 (ios)
http://docs.aws.amazon.com/devicefarm/latest/developerguide/welcome.html

Books:
https://pragprog.com/book/hwcuc/the-cucumber-book