ticalabash: fully automated acceptance testing @ ticonf eu 2014

22
Ti Calabash: TiCalabash for Titanium: Fully Automated Testing.

Upload: andrew-mcelroy

Post on 06-May-2015

1.817 views

Category:

Technology


1 download

DESCRIPTION

Acceptance testing has become a crucial step of software development, but it has been a noticeably missing piece of the Titanium mobile application development puzzle. TiCalabash is a new tool, developed specifically for Titanium to bring mobile development a significant step forward in reducing time and resource risk and increasing user acceptance and overall quality of development. Fully automated, using human-readable language, and offering full end-to-end acceptance testing, TiCalabash should be a major part of your mobile development toolbox.

TRANSCRIPT

Page 1: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Ti Calabash: TiCalabash for Titanium: Fully Automated Testing.

!

Page 2: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Platino Talk?

Page 3: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Game Development with Titanium

https://github.com/gouldjw/tiConf-Mobile-Dev-Wars-Demo

https://vimeo.com/96590732

https://www.slideshare.net/gouldjw13/ticonf2014-gdtph-10may14ext

http://www.avatar-soft.com/#tiConf2014

Page 4: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Acceptance Testing

Page 5: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Acceptance Testing

AKA User Acceptance Testing

What is it?

Page 6: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Acceptance TestingTest the entire App from the UI down rather

than Units (aka Unit Testing)

Unit Testing + Acceptance Testing === Outside-in BDD<sidenote>

http://www.sarahmei.com/blog/2010/05/29/outside-in-bdd/

credit: http://lostechies.com

</sidenote>

Page 7: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Before Acceptance TestingSome Pain Points

Many devices, OS versions, Languages, Form Factors, Screen Density/Size…

Time consuming process of manually clicking through screens.

Catch and stop regressions

Page 8: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

The Original VisionA Natural Language Like DSL

Extensible via ‘step definitions’

Supports Continuous Integration

No Titanium Modules

No touching tiapp.xml

Use only a Titanium CLI hook

No Ruby Dependencies

Page 9: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Calabash Overview

“Calabash supports Cucumber. Cucumber lets us express the behavior of our app

using natural language that can be understood by business experts and non-

technical QA staff.”— Calaba.sh

“…Calabash is cross-platform, supporting Android and iOS native apps…”

Page 10: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

About that no Ruby thing…

TiCucumber was too much work for too little reward.

Matt Apperson had a better idea

Page 11: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

TiCalabashA Titanium CLI hook for CalabashCalabash is Cucumber for Mobile

npm install -g ticalabashhttps://github.com/appersonlabs/ticalabash

Page 12: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

A FeatureThis is executable code:

https://github.com/CodexLabs/alloy_fugitive/blob/master/features/fugitive.feature

Page 13: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Step Definitions

https://github.com/calabash/calabash-ios/blob/master/calabash-cucumber/features/step_definitions/calabash_steps.rbhttps://github.com/calabash/calabash-android/tree/master/ruby-gem/lib/calabash-android/steps

An Example

Page 14: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Custom Step DefinitionsAdd your own steps:

Page 15: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Demo

Page 16: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Architecture of CalabashFYI (for the curious)

features

Cucumber (On Dev computer)

iOS/ Android App

Calabash library (contains a web server

iOS: Frank Android: Robotium)

*On iOS it uses -cal scheme

Cucumber test reporter

REST API

Page 17: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Calabash QueriesYou can use calabash to query your UI

http://blog.lesspainful.com/2012/12/18/Android-Query/http://roadtoautomation.blogspot.nl/2013/12/road-to-identifying-elements-using.html

https://github.com/calabash/calabash-ios/wiki/05-Query-syntax

query("all button") query("all view marked:'something'")

Page 18: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Recording TouchesWe haven’t exposed it yet

“for reasons”

https://github.com/calabash/calabash-ios/wiki/04-Touch-recording-and-playback

Only works for iOS < 7 There appears to be hope for iOS 7

http://stackoverflow.com/questions/18205130/calabash-how-to-record-touches-on-iphone

!Calabash Android doesn’t implement it.

There is a Robotium Recorder however.

If you need touch recording today, just use Appcelerator Platform.

Page 19: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Recording Touches$ calabash-ios console !Now use the command record_begin !> record_begin => "" This begins recording touch events. Now in the simulator perform the touch events you want to record. This should be a short sequence of events corresponding to a gesture on a view. Then use record_end "mytouches", for example !> record_end "drag_one_up" => "drag_one_up_ios5_iphone.base64" This saves the touch events under the name "mytouches". In the example, you see the string "drag_one_up_ios5_iphone.base64". This is actually a file being saved in your directory. !You can test that the recording does what it should by running !> playback "drag_one_up" => ["<UIView: 0x7dc70b0; frame = (-48.7356 26.2644; 417.471 417.471); ... This will playback the events you just recorded at the same coordinates you recorded them. If you're unhappy with the results just try again. !If you're happy, exit the console and move the generated file to the "features" folder.

Page 20: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

JenkinsThe Configuration

cd ~/Desktop/ticonf2014testappdemo/alloytest # or actually pull from git. titanium clean titanium build --platform=iphone --test & sleep 30 killall "iPhone Simulator" export PATH=“/Users/andrewmcelroy/.rbenv/shims:/Users/andrewmcelroy/bin:/usr/local/bin: /Users/andrewmcelroy/.rbenv/bin:/Users/andrewmcelroy/android/tools:/Users/andrewmcelroy/android/: /Users/andrewmcelroy/android//tools:/Users/andrewmcelroy/android/platform-tools/:/usr/bin:/bin: /usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:" !echo | titanium calabash —platform=iphone !cd ~/Library/Application Support/iPhone Simulator/7.1/Applications/ AppGUID = $(find . -name "alloytest" | cut -d "/" -f 2) !cp "~/Library/Application Support/iPhone Simulator/7.1/Applications/$AppGUID/Documents/jenkins.xml" $WORKSPACE/jenkins.xml

Page 21: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Questions?

!

Page 22: TiCalabash: Fully automated Acceptance Testing @ TiConf EU 2014

Thank You

Andrew McElroyhttps://CodexLabs.com

github.com/CodexLabs@CodexLabs

Matt Apperson@mattapperson

Special thanks to Matt for the Android implementation