Slide 1

Slide 1 text

Automated UI Testing: Xamarin TestCloud & Calabash Friday, May 31, 13

Slide 2

Slide 2 text

David Ortinau @davidortinau http://davidortinau.com 17 yrs web, desktop, interactive, mobile. BA English, Maryville University Friday, May 31, 13

Slide 3

Slide 3 text

Friday, May 31, 13

Slide 4

Slide 4 text

Friday, May 31, 13

Slide 5

Slide 5 text

Friday, May 31, 13

Slide 6

Slide 6 text

Let’s Talk About • Xamarin TestCloud • Calabash • Demo Friday, May 31, 13

Slide 7

Slide 7 text

+= Friday, May 31, 13

Slide 8

Slide 8 text

Xamarin TestCloud Upload any IPA or APK Provide test scripts or use Xamarin Explorer Connect with continuous integration systems Results include screenshots of every test, step through events, stack trace output Reports performance, memory usage Slow is a bug Friday, May 31, 13

Slide 9

Slide 9 text

Friday, May 31, 13

Slide 10

Slide 10 text

How will it scale? Friday, May 31, 13

Slide 11

Slide 11 text

Friday, May 31, 13

Slide 12

Slide 12 text

Friday, May 31, 13

Slide 13

Slide 13 text

Calabash C# Calabash Android Calabash iOS Your App Calabash Server Calabash Clients Device, Emulator or Simulator Host computer High-level Architecture JSON over HTTP ............ Friday, May 31, 13

Slide 14

Slide 14 text

Calabash Init • Ruby 1.9.3 and bundler • Recommend rvm or rbenv / ruby-build to manage Ruby and Gems • $ gem install calabash-cucumber • $ calabash-ios setup • $ calabash-ios gen • Add calabash.framework to your project directory and link it • XCode: -force_load "$(SRCROOT)/calabash.framework/calabash" -lstdc++ • Xamarin: -force_load $(ProjectDir)/calabash.framework/calabash -lstdc++ • $ bundle exec cucumber -p ios features/login.feature Friday, May 31, 13

Slide 15

Slide 15 text

Test Architecture • Features • Step Definitions • Page Objects / Interfaces Friday, May 31, 13

Slide 16

Slide 16 text

Login Feature Feature: Login Scenario: Login with valid user Given I am on the Login screen When I login as "Nat" Then I should go to the Assignments screen Scenario: Login with invalid user Given I am on the Login screen When I login as "Invalid" Then I should not be logged in And I should see a login error message Friday, May 31, 13

Slide 17

Slide 17 text

Login Step Definition Given /^I am on the Login screen$/ do await(LoginScreen) screenshot_embed(:label => 'Login') end When /^I login as "([^"]*)"$/ do |user_str| user = USERS[user_str.downcase.to_sym] login(:as => user) end Then /^I should go to the Assignments screen$/ do assert_screen(AssignmentsScreen) screenshot_embed(:label => 'Assignments') end https://github.com/calabash/calabash-ios/blob/master/calabash-cucumber/features/step_definitions/calabash_steps.rb Friday, May 31, 13

Slide 18

Slide 18 text

Login Page require 'calabash-cucumber/ibase' class LoginScreen < Calabash::IBase def trait "button marked:'Log In'" end def login(user) tap "Username" await_keyboard keyboard_enter_text user[:email] done keyboard_enter_text user[:password] tap('Log In') wait_for_elements_do_not_exist(['activityIndicatorView']) assignments = page(AssignmentsScreen) begin assignments.await rescue self end end Friday, May 31, 13

Slide 19

Slide 19 text

Friday, May 31, 13

Slide 20

Slide 20 text

Calabash Console $ calabash-ios console irb> query(“button”) irb> query(“button marked:‘Active’”) irb> query(“button marked:‘Accept’”) irb> query(“button marked:‘Accept’”)[0] irb> record_begin irb> record_end “feature_name” Friday, May 31, 13

Slide 21

Slide 21 text

Resources Friday, May 31, 13

Slide 22

Slide 22 text

Resources • Xamarin Evolve Videos • Intro to Calabash: http://xamarin.com/evolve/2013#session-xcjpj20d6s • TestCloud: http://xamarin.com/evolve/2013#keynote-80:44 • Calabash • http://calaba.sh/ • iOS: https://github.com/calabash/calabash-ios • Android: https://github.com/calabash/calabash-android • https://github.com/aduggin/calabash-ios-tutorial • Field Service Example with Calabash Tests • https://github.com/calabash/field-service-example • Cucumber • http://cukes.info/ • http://pragprog.com/book/hwcuc/the-cucumber-book • Frank • http://www.testingwithfrank.com/ Friday, May 31, 13

Slide 23

Slide 23 text

Thanks! @davidortinau http://davidortinau.com dave@davidortinau.com Friday, May 31, 13