one test to rule them all - conquer android and ios with one script

32
ONE TEST TO RULE THEM ALL - CONQUER ANDROID AND IOS WITH ONE SCRIPT EYAL YOVEL, SOLUTION ARCHITECT QUALITEST GROUP AUGUST 29, 2017 ASAF SAAR, MOBILE PRODUCT MANAGEMENT DIRECTOR, SAUCE LABS

Upload: sauce-labs

Post on 29-Jan-2018

670 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: One Test To Rule Them All - Conquer Android and iOS With One Script

ONE TEST TO RULE THEM ALL - CONQUER ANDROID AND IOS WITH ONE SCRIPTEYAL YOVEL, SOLUTION ARCHITECT QUALITEST GROUP

AUGUST 29, 2017

ASAF SAAR, MOBILE PRODUCT MANAGEMENT DIRECTOR, SAUCE LABS

Page 2: One Test To Rule Them All - Conquer Android and iOS With One Script

AUGUST 29, 2017

EYAL YOVEL, SOLUTION ARCHITECT QUALITESTGROUP

ASAF SAAR, MOBILE PRODUCT MANAGEMENT

DIRECTOR, SAUCE LABS

Page 3: One Test To Rule Them All - Conquer Android and iOS With One Script

MOBILE TESTING STRATEGY

Page 4: One Test To Rule Them All - Conquer Android and iOS With One Script

Mobile App TestingWeb Testing

The industry’s only cloud-based testing platform for both web and mobile applications that spans desktops,

simulators, emulators and real devices

Desktops Emulators & Simulators Real Devices

Page 5: One Test To Rule Them All - Conquer Android and iOS With One Script

MOBILE FIRST AT SCALE

By 2022, 70% of software interactions in enterprises will occur on mobile devices.

MarketGuideforMobileApplicationTestingServicesSusanneMatson(June2017)

Page 6: One Test To Rule Them All - Conquer Android and iOS With One Script

CURRENT MOBILE OFFERING

Manual Testing

Automated Testing

Emulators & Simulators

Public Cloud Private Cloud

Real Devices

Public Cloud

Mobile Testing

SECURITY & PRIVACY

Page 7: One Test To Rule Them All - Conquer Android and iOS With One Script

GARTNER SUPPORTS OUR APPROACH

A recommended approach is to find a healthy mix of emulators, simulators and real devices to get the best out of your test automation.

MarketGuideforMobileAppTestAutomationToolsMaritessSobejana(April2016)

Page 8: One Test To Rule Them All - Conquer Android and iOS With One Script

COMPREHENSIVE MOBILE TESTING

Device Testing (on Wi-FiNetworks + Networks

Simulation Tools)

● Recommended only for small subset of network-dependent use cases

● Use for stable features● Distribute features across device models and form factors● Important for UX Testing● Combine with WANem or similar tools for simulating

network connectivity conditions

● High volume functional tests for large integration builds● Frequent builds with high concurrency to reduce build times,

enabling dev teams to not block each other

Device Testing

(in network)

Device Testing (on Wi-FiNetworks + Networks

Simulation Tools)

Emulator&Simulator Testing

EMULATORS, SIMULATORS & REAL DEVICES COVER ALL USE CASES

Page 9: One Test To Rule Them All - Conquer Android and iOS With One Script

THE CHALLENGES FACED BY QA

Page 10: One Test To Rule Them All - Conquer Android and iOS With One Script

THE CHALLENGES FACED BY QA

AUGUST 29, 2017 © Sauce Labs, Inc. 10

Appiumisanopensourcetoolforautomatingnative,mobileweband

hybridapplicationsoniOSandAndroidplatforms

Page 11: One Test To Rule Them All - Conquer Android and iOS With One Script

THE CHALLENGES FACED BY QA

AUGUST 29, 2017 © Sauce Labs, Inc. 11

Page 12: One Test To Rule Them All - Conquer Android and iOS With One Script

THE CHALLENGES FACED BY QA

AUGUST 29, 2017 © Sauce Labs, Inc. 12

HowtospeedupwritingtestsusingtheSerenityBDDFrameworkandthePageObjectModel

Challengesandsolutionsfordevelopingacross-platformmobiletestingsolution

Howtodefineandimplementamobiletestingstrategy

Page 13: One Test To Rule Them All - Conquer Android and iOS With One Script

PAGE OBJECT MODEL

Page 14: One Test To Rule Them All - Conquer Android and iOS With One Script

WHAT IS A PAGE OBJECT MODEL

AUGUST 29, 2017

• Modelling UI components as objects to be consumed by test code

• Representation of the services offered by a page

• Abstracts test logic away from interaction with the WebDriver API and System-Under-Test

© Sauce Labs, Inc. 14

Page 15: One Test To Rule Them All - Conquer Android and iOS With One Script

WHY PAGE OBJECT MODEL

AUGUST 29, 2017

• Expose page and component services rather than mechanics

• Write concise tests that exercise functionality, not technical details

• Create maintainable tests by isolating the effect of UI change on test code

• Produce readable tests by keeping implementation details out of test code.

© Sauce Labs, Inc. 15

Page 16: One Test To Rule Them All - Conquer Android and iOS With One Script

AUGUST 29, 2017

• Tests are comprised of steps

• Steps interact with pages• Pages provide services and key components• Operations on pages occur without any knowledge

of page structure

• Pages are comprised of elements

• Each element represents a single item on a page that can be interacted with• Text, buttons, fields, images, etc.

LAYERS OF ABSTRACTION

© Sauce Labs, Inc. 16

Steps

PageObjects

Elements

Tests

Page 17: One Test To Rule Them All - Conquer Android and iOS With One Script
Page 18: One Test To Rule Them All - Conquer Android and iOS With One Script

INTRODUCING

AUGUST 29, 2017

• Demonstrating the Page Object Model requires a testing framework

• Serenity is an open source Java (and recently JavaScript) library to speed up writing tests; including:• Complete WebDriver testing framework• Parallel execution of tests using JUnit, Cucumber or JBehave• Integration with Sauce Labs, Appium, JIRA, and other testing tools• Detailed reporting

• Well used across the industry.

© Sauce Labs, Inc. 18

Page 19: One Test To Rule Them All - Conquer Android and iOS With One Script

ABOUT THE DEMO ENVIRONMENT

Page 20: One Test To Rule Them All - Conquer Android and iOS With One Script

THE SYSTEM UNDER TEST

AUGUST 29, 2017 © Sauce Labs, Inc. 20

My giffgaff App – A UK mobile network

Page 21: One Test To Rule Them All - Conquer Android and iOS With One Script

AUGUST 29, 2017

Introducing a basic Serenity test

Scenario: Log in to the giffgaff App

Given I am not logged inWhen I log in as ‘eyalyovel’Then I am logged in as ‘eyalyovel’

Framework:• Serenity, Appium, BDD (feature file) and Maven• Execute on local Samsung galaxy S6 device and on

iPhone 7 simulator located on the Sauce Labs cloud • Hard-coded test data

LOGIN TEST

© Sauce Labs, Inc. 21

StepsLoginSteps

PageObjectsLoginPage

MygiffgaffAccountPage

ElementsusernameFieldpasswordFieldloginButton

TestLogin.feature

Page 22: One Test To Rule Them All - Conquer Android and iOS With One Script

AUGUST 29, 2017

DEMO THE FRAMEWORK

© Sauce Labs, Inc. 22

Page 23: One Test To Rule Them All - Conquer Android and iOS With One Script

CHALLENGES AND SOLUTIONS FOR DEVELOPING A CROSS-PLATFORM

MOBILE TESTING SOLUTION

Page 24: One Test To Rule Them All - Conquer Android and iOS With One Script

FIND ELEMENTS IN ANDROID AND IOS

AUGUST 29, 2017

IN MOST CASES WE WILL NOT BE ABLE TO FIND AN ELEMENT USING THE SAME IDENTIFIER IN ANDROID AND IOS

© Sauce Labs, Inc. 24

Page 25: One Test To Rule Them All - Conquer Android and iOS With One Script

FIND ELEMENTS IN ANDROID AND IOS

AUGUST 29, 2017

IN MOST CASES WE WILL NOT BE ABLE TO FIND AN ELEMENT USING THE SAME IDENTIFIER IN ANDROID AND IOS

© Sauce Labs, Inc. 25

Page 26: One Test To Rule Them All - Conquer Android and iOS With One Script

DIFFERENCES IN BEHAVIOR

AUGUST 29, 2017

DIFFERENCES IN BEHAVIOR BETWEEN THE PLATFORMS

FOR EXAMPLE: FIND THE MEMBER NAME:

© Sauce Labs, Inc. 26

Page 27: One Test To Rule Them All - Conquer Android and iOS With One Script

DIFFERENCES IN BEHAVIOR

AUGUST 29, 2017

DIFFERENCES IN BEHAVIOR BETWEEN THE PLATFORMS

FOR EXAMPLE: FIND THE MEMBER NAME:

© Sauce Labs, Inc. 27

Page 28: One Test To Rule Them All - Conquer Android and iOS With One Script

SOLUTION FOR FIND ELEMENTS

AUGUST 29, 2017

USE THE ANNOTATIONS @ANDROIDFINDBY AND @IOSFINDBY

© Sauce Labs, Inc. 28

Page 29: One Test To Rule Them All - Conquer Android and iOS With One Script

SOLUTION FOR DIFFERENCES IN BEHAVIOR

AUGUST 29, 2017

WE WILL NEED DIFFERENT STEPS/CODE FOR THE DIFFERENT PLATFORMS FOR EXECUTING THE SAME SCENARIO.

© Sauce Labs, Inc. 29

• We can have different page object files for the Android and the iOS pages

• Before running the tests, find what is the platform and run the code according to that

Page 30: One Test To Rule Them All - Conquer Android and iOS With One Script

AUGUST 29, 2017

DEMO RUN ON ANDROID PLATFORM

© Sauce Labs, Inc. 30

Page 31: One Test To Rule Them All - Conquer Android and iOS With One Script

AUGUST 29, 2017

DEMO RUN ON IOS PLATFORM

© Sauce Labs, Inc. 31

Page 32: One Test To Rule Them All - Conquer Android and iOS With One Script

LET’S DO THIS.