Appium + Cucumber Framework

  • View
    22

  • Download
    0

Embed Size (px)

Text of Appium + Cucumber Framework

Mobile Automation with Appium & Cucumber

Mobile Automation with Appium & Cucumberchris.wu | HeHa Digital Health Ltd

AgendaAppium Writing test cases in CucumberC.I Test Pipelines Future WorksDemos

The Dark Age:

The Dark Age

javajs/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-PhoneStandard API Spec based on Selenium WebDriver APIs available in most popular programming languages -> We use Java :)

https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol

ONE API works for Two Platforms!Similar to Selenium WebDriver API, but for iOS & Android

https://discuss.appium.io/t/difference-between-webelement-mobileelement-androidelement-and-ioselement/5254

WebElement is a general interface that all the other classes (RemoteWebElement, MobileElement, AndroidElement, IOSElement) implement. which means that if you have an object of type WebElement it will have all the basic functions a web element can have. If you need more specific functions you can use other objects like: RemoteWebElement, MobileElement, AndroidElement, IOSElement

Tools

Test Project: contains screen SDK, cucumber test cases, test definition glues test SDK and test scriptsMobile Ctrl: provides a base screen class, and some useful test utilities: logging, recording, and other basic ui actions wrapper. Automation Common: provides java client for access api backend, e.g. get sms code, soft delete user, get member detail, etc.

Creating a test projectEach test project should consist of 3 parts:

Screen SDK: screen-based classesCucumber Feature Files: test cases, test data. Cucumber Step Definition: glue layer connects cucumber script (#1) and SDK layer (#3)

Cucumber? take about it later.

Create Screen SDK - Page Object PatternExposes 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.

http://martinfowler.com/bliki/PageObject.htmlThe Page Object pattern represents the screens of your web app as a series of objects and encapsulates the features represented by a page.

Creating a test project:Each test project consist of 3 components:

Screen SDK: list of screen-based classesCucumber Feature Files: test cases, test data. Cucumber Step Definition: glue layer connects cucumber script (#1) and SDK layer (#3)

This is where you keep all the test cases, test data.

Cucumber is a tool that executes plain-text as automated testsTests 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 AppEach test project should consist of 3 layers:

Screen SDK: list of screen-based classesCucumber Feature Files: test cases, test data. Cucumber Step Definition: glues cucumber test steps and screen test SDK.

Cucumber? take about it later.

Screen SDK

Cucumber feature file

Screen SDKCucumber feature fileStep Definition!

Creating a Test Project

Screen SDKsCucumber Step DefinitionsCucumber Features/Scenarios/Steps

Cucumber? take about it later.

Inspect Android IDsAndroid SDK monitor

Inspect iOS IDsAppium GUI

Inspect iOS IDs on Screen - Cont.Appium GUI

Automation setup guideCucumber guide

Write New Test CaseLaunch app and login as guest

STEPs: Write test case in cucumber feature fileImplement test definition Implement screen classes if the UI functions are not yet exist

Mobile Pipeline IntegrationAutomated Build, Test, Slack NotificationCucumber Test ReportVideos, Logs

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

Automation Slave Machine

Future Works (Framework) Multi App Language Support Support Android SimulatorSupport Distributed / Parallel TestingIntegrate with Cloud Device FarmUpgrade to Appium 1.6 and Xcode 8