Appium + Cucumber Framework

Preview:

Citation preview

Mobile Automation with Appium & Cucumber

chris.wu | HeHa Digital Health Ltd

Agenda

• Appium • Writing test cases in Cucumber• C.I Test Pipelines • Future Works• Demos

The Dark Age:

The Dark Agejava

js/swift

?

Problems:

• Too many programming lang and API spec !!• Maintain separate projects for iOS and

Android of the same product • Duplicate work for test case scripts and test

data, leads to risk of misalignment

What if …

• Cross platform: supports iOS, Android, and even FirefoxOS, Windows-Phone

• Standard API Spec based on Selenium WebDriver • APIs available in most popular programming

languages -> We use Java :)

ONE API works for Two Platforms!

Similar to Selenium WebDriver API, but for iOS & Android

Tools

Creating a test project

Each test project should consist of 3 parts:

• Screen SDK: screen-based classes• Cucumber Feature Files: test cases, test

data. • Cucumber Step Definition: glue layer

connects cucumber script (#1) and SDK layer (#3)

Create Screen SDK - Page Object Pattern

Exposes methods that reflect the things user can do and see on that screen/page:

Why? • Reduces the duplication of code • Makes tests more readable and robust • Improves the maintainability of tests, when

there is frequent change in the AUT.

Creating a test project:

Each test project consist of 3 components:

• Screen SDK: list of screen-based classes• Cucumber Feature Files: test cases, test

data. • Cucumber Step Definition: glue layer

connects cucumber script (#1) and SDK layer (#3)

• Cucumber is a tool that ‘executes plain-text’ as automated tests

• Tests written in human readable text, and supports over 40 human languages: includes English, Chinese, etc.

• Provide powerful ways of organizing test case and test data

• Implement cucumber test steps in various language: Ruby, Java, Scala, Groovy, etc.

Creating a test project for an App

Each test project should consist of 3 layers:

• Screen SDK: list of screen-based classes• Cucumber Feature Files: test cases, test

data. • Cucumber Step Definition: glues cucumber

test steps and screen test SDK.

Screen SDK

Cucumber feature file

Screen SDK

Cucumber feature file

Step Definition!

Creating a Test ProjectScreen SDKs

Cucumber Step Definitions

Cucumber Features/Scenari

os/Steps

Inspect Android IDsAndroid SDK monitor

Inspect iOS IDs

Appium GUI

Inspect iOS IDs on Screen - Cont.

Appium GUI

Write New Test Case

Launch app and login as guest

STEPs: 1. Write test case in cucumber feature file2. Implement test definition 3. Implement screen classes if the UI functions are not

yet exist

Mobile Pipeline Integration

• Automated Build, Test, Slack Notification• Cucumber Test Report• Videos, Logs

http://jenkins.iheha.com/view/Walking%20Mobile%20Pipeline/

Automation Slave Machine

Future Works (Framework)

• Multi App Language Support• Support Android Simulator• Support Distributed / Parallel Testing• Integrate with Cloud Device Farm• Upgrade to Appium 1.6 and Xcode 8

Recommended