├── .ruby-version ├── Gemfile ├── features ├── support │ ├── env.rb │ ├── hooks.rb │ ├── start_app.rb │ └── appium_custom.rb ├── step_definitions │ ├── screen │ │ ├── display_message_sreen.rb │ │ └── main_screen.rb │ └── play_steps.rb ├── demonstrate.feature └── play.feature ├── AndroidTestApp ├── ic_launcher-web.png ├── libs │ └── android-support-v4.jar ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── menu │ │ ├── main.xml │ │ └── display_message.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ ├── activity_display_message.xml │ │ └── activity_main.xml ├── proguard-project.txt ├── src │ └── com │ │ └── example │ │ └── androidtestapp │ │ ├── MainActivity.java │ │ └── DisplayMessageActivity.java └── AndroidManifest.xml └── README.md /.ruby-version: -------------------------------------------------------------------------------- 1 | 1.9.3-p362 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'selenium-webdriver', '2.35.1' 4 | gem 'cucumber', '1.3.8' 5 | -------------------------------------------------------------------------------- /features/support/env.rb: -------------------------------------------------------------------------------- 1 | require "selenium-webdriver" 2 | 3 | $wait = Selenium::WebDriver::Wait.new(:timeout => 30) 4 | 5 | -------------------------------------------------------------------------------- /AndroidTestApp/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesbarker/cucumber-appium-android/HEAD/AndroidTestApp/ic_launcher-web.png -------------------------------------------------------------------------------- /AndroidTestApp/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesbarker/cucumber-appium-android/HEAD/AndroidTestApp/libs/android-support-v4.jar -------------------------------------------------------------------------------- /AndroidTestApp/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesbarker/cucumber-appium-android/HEAD/AndroidTestApp/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidTestApp/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesbarker/cucumber-appium-android/HEAD/AndroidTestApp/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidTestApp/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesbarker/cucumber-appium-android/HEAD/AndroidTestApp/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidTestApp/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jamesbarker/cucumber-appium-android/HEAD/AndroidTestApp/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /features/support/hooks.rb: -------------------------------------------------------------------------------- 1 | Before do 2 | $driver ||= start_app 3 | 4 | $wait.until { 5 | main_screen_present? 6 | } 7 | 8 | end 9 | 10 | After do 11 | $driver.quit 12 | $driver=nil 13 | end 14 | -------------------------------------------------------------------------------- /features/step_definitions/screen/display_message_sreen.rb: -------------------------------------------------------------------------------- 1 | def display_screen_visit 2 | #todo 3 | end 4 | 5 | def display_screen_present? 6 | id_text('android:id/action_bar_title') == 'DisplayMessageActivity' 7 | end 8 | 9 | -------------------------------------------------------------------------------- /AndroidTestApp/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AndroidTestApp/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /AndroidTestApp/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /AndroidTestApp/res/menu/display_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /AndroidTestApp/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /features/step_definitions/screen/main_screen.rb: -------------------------------------------------------------------------------- 1 | def main_screen_visit 2 | $wait.until { main_screen_present? } 3 | end 4 | 5 | def main_screen_present? 6 | button_exists? 'Send' 7 | end 8 | 9 | def main_screen_click_send_button 10 | click_button 'Send' 11 | end 12 | 13 | def main_screen_message message 14 | fill_in 'com.example.androidtestapp:id/edit_message', message 15 | end 16 | -------------------------------------------------------------------------------- /AndroidTestApp/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /features/demonstrate.feature: -------------------------------------------------------------------------------- 1 | Feature: Demonstrate 2 | As a BDD tester 3 | I want an automated Android mobile BDD testing framework 4 | So I can streamline my development process 5 | 6 | Scenario: Welcome Message 7 | Given I am on the "Main" screen 8 | And I enter text "Hello World!" 9 | When I click the "Send" button 10 | Then I am taken to the "Display Message" screen 11 | And the message "Hello World!" is displayed 12 | -------------------------------------------------------------------------------- /AndroidTestApp/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /AndroidTestApp/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Android Test App 5 | Enter a message 6 | Send 7 | Settings 8 | MainActivity 9 | DisplayMessageActivity 10 | 11 | -------------------------------------------------------------------------------- /features/step_definitions/play_steps.rb: -------------------------------------------------------------------------------- 1 | Given(/^I am on the "Main" screen$/) do 2 | main_screen_visit 3 | end 4 | 5 | Given(/^I enter text "(.*?)"$/) do |message| 6 | main_screen_message message 7 | end 8 | 9 | When(/^I click the "Send" button$/) do 10 | main_screen_click_send_button 11 | end 12 | 13 | When(/^I click the "Send" button without a message$/) do 14 | main_screen_click_send_button 15 | end 16 | 17 | Then(/^I am taken to the "Display Message" screen$/) do 18 | display_screen_present? 19 | end 20 | 21 | Then(/^the message "(.*?)" is displayed$/) do |message| 22 | text_exists? message 23 | end 24 | 25 | -------------------------------------------------------------------------------- /features/play.feature: -------------------------------------------------------------------------------- 1 | Feature: Play Around 2 | As a BDD tester 3 | I want an example of Cucumber working with Android and Appium 4 | So I can see if it is a feasible framework for my own project 5 | 6 | Scenario: No Message 7 | Given I am on the "Main" screen 8 | When I click the "Send" button without a message 9 | Then I am taken to the "Display Message" screen 10 | And the message "No Message!" is displayed 11 | 12 | Scenario: Special Characters 13 | Given I am on the "Main" screen 14 | And I enter text "$Hello & Welcome!!" 15 | When I click the "Send" button 16 | Then I am taken to the "Display Message" screen 17 | And the message "$Hello & Welcome!!" is displayed 18 | -------------------------------------------------------------------------------- /AndroidTestApp/res/layout/activity_display_message.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /features/support/start_app.rb: -------------------------------------------------------------------------------- 1 | def start_app 2 | def capabilities 3 | { 4 | "device" => "Android", 5 | "browserName" => "", 6 | "version" => "4.3", 7 | "app" => "#{Dir.pwd}/AndroidTestApp/bin/MainActivity-debug.apk", 8 | "app-package" => "com.example.androidtestapp", 9 | "app-activity" => "com.example.androidtestapp.MainActivity" 10 | } 11 | end 12 | 13 | http_client = ::Selenium::WebDriver::Remote::Http::Default.new 14 | http_client.timeout = 80 15 | 16 | 17 | Selenium::WebDriver.for( 18 | :remote, 19 | :desired_capabilities => capabilities, 20 | :url => 'http://127.0.0.1:4723/wd/hub', 21 | :http_client => http_client 22 | ) 23 | end -------------------------------------------------------------------------------- /AndroidTestApp/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /AndroidTestApp/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /AndroidTestApp/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 18 |