Download pptx - Appium + Cucumber Framework

Transcript
Page 1: Appium + Cucumber Framework

Mobile Automation with Appium & Cucumber

chris.wu | HeHa Digital Health Ltd

Page 2: Appium + Cucumber Framework

Agenda

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

Page 3: Appium + Cucumber Framework

The Dark Age:

Page 4: Appium + Cucumber Framework

The Dark Agejava

js/swift

?

Page 5: Appium + Cucumber Framework

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

Page 6: Appium + Cucumber Framework

What if …

Page 7: Appium + Cucumber Framework

• 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 :)

Page 8: Appium + Cucumber Framework
Page 9: Appium + Cucumber Framework

ONE API works for Two Platforms!

Similar to Selenium WebDriver API, but for iOS & Android

Page 10: Appium + Cucumber Framework

Tools

Page 11: Appium + Cucumber Framework

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)

Page 12: Appium + Cucumber Framework

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.

Page 13: Appium + Cucumber Framework
Page 14: Appium + Cucumber Framework

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)

Page 15: Appium + Cucumber Framework

• 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.

Page 16: Appium + Cucumber Framework

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.

Page 17: Appium + Cucumber Framework

Screen SDK

Cucumber feature file

Page 18: Appium + Cucumber Framework

Screen SDK

Cucumber feature file

Step Definition!

Page 19: Appium + Cucumber Framework

Creating a Test ProjectScreen SDKs

Cucumber Step Definitions

Cucumber Features/Scenari

os/Steps

Page 20: Appium + Cucumber Framework

Inspect Android IDsAndroid SDK monitor

Page 21: Appium + Cucumber Framework

Inspect iOS IDs

Appium GUI

Page 22: Appium + Cucumber Framework

Inspect iOS IDs on Screen - Cont.

Appium GUI

Page 23: Appium + Cucumber Framework
Page 24: Appium + Cucumber Framework

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

Page 25: Appium + Cucumber Framework

Mobile Pipeline Integration

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

Page 26: Appium + Cucumber Framework

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

Page 27: Appium + Cucumber Framework

Automation Slave Machine

Page 28: Appium + Cucumber Framework

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

Page 29: Appium + Cucumber Framework

Recommended