uber’s fascinating world of inter-app communications

21
W2 Track Session 4/20/2016 10:00 AM "Uber’s Fascinating World of Inter- App Communications" Presented by: Apple Chow & Bian Jiang Uber Brought to you by: 340 Corporate Way, Suite 300, Orange Park, FL 32073 888-268-8770 ∙ 904-278-0524 ∙ [email protected] www.techwell.com

Upload: josiah-renaudin

Post on 19-Feb-2017

97 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Uber’s Fascinating World of Inter-App Communications

W2 Track Session 4/20/2016 10:00 AM

"Uber’s Fascinating World of Inter-App Communications"

Presented by:

Apple Chow & Bian Jiang Uber

Brought to you by:

340 Corporate Way, Suite 300, Orange Park, FL 32073 888-268-8770 ∙ 904-278-0524 ∙ [email protected] ∙ www.techwell.com

Page 2: Uber’s Fascinating World of Inter-App Communications

Apple Chow Uber Apple Chow is the engineering manager for Uber’s mobile test infra team, which focuses on building tools and infrastructure for Uber’s fast-growing mobile organization. Previously, Apple was the engineering productivity lead at Google where she led releases and worked on building out the testing infrastructure for many of Google’s mobile and web products including Google Hangouts, Google Maps, YouTube, Google Now, Google CRM, Google Offers, Google Checkout, and OpenSocial.

Bian Jiang Uber Bian Jiang has extensive experience in both mobile application development and mobile application testing. For the mobile test infra team at Uber, he helps design and build testing tools and infrastructure, such as Octopus, a multi-app and multi-device coordinating test runner. Bian was a key member of the team which built and shipped the new Yahoo! Mail iOS client from scratch in just twelve weeks.

Page 3: Uber’s Fascinating World of Inter-App Communications

4/13/16

1

Evolution of Octopus at Uber Apple Chow, Bian Jiang Mobile Dev & Test (April 20, 2016)

Our Uber Challenge Soon after we started at Uber, we encountered a fresh testing challenge. Can you guess what it is?

Page 4: Uber’s Fascinating World of Inter-App Communications

4/13/16

2

Our Uber Challenge

What makes testing Uber’s mobile apps significantly

different from, say, testing Google Maps?

Page 5: Uber’s Fascinating World of Inter-App Communications

4/13/16

3

Our Uber Challenge - The Answer

The Driver and Rider App are tied together!

Not Only Our Challenge

Messaging

Apps!

Games!

Anything involving multiple user communication!

Page 6: Uber’s Fascinating World of Inter-App Communications

4/13/16

4

Octopus Our Uber Useful Solution

Page 7: Uber’s Fascinating World of Inter-App Communications

4/13/16

5

Why Octopus?

•  Unified •  Extensible •  Parallelized •  Signaling

Octopus Overview

•  Streamlines the following:

- Prepare test targets

- Run tests (handles signaling)

- Create test results reports

- Pull test artifacts

- Perform clean ups

What does it do?

Page 8: Uber’s Fascinating World of Inter-App Communications

4/13/16

6

Octopus in Action (Parallelized Test Run)

Page 9: Uber’s Fascinating World of Inter-App Communications

4/13/16

7

Octopus - Deep Dive Bian

Octopus Design Philosophy

•  Easy to Use

•  Robust

•  Integrate with Existing UI Automation Frameworks (UiAutomator, Espresso)

Page 10: Uber’s Fascinating World of Inter-App Communications

4/13/16

8

Octopus - Signaling

Signaling - Terminology

•  Test Host

•  Test Target

•  Channel

•  Signal

Page 11: Uber’s Fascinating World of Inter-App Communications

4/13/16

9

Signaling - How it works?

Test Target (driver)

Test Target (rider)

driver_online

requested_trip

Signaling - (very simple) API

•  readSignal(channel, timeout)

- Blocking till a signal or timeout

•  writeSignal(channel, content)

- Nonblocking call

Page 12: Uber’s Fascinating World of Inter-App Communications

4/13/16

10

Signaling - API calls

Test Target (driver)

Test Target (rider)

writeSignal(“driver_inbox”, “requested_trip”)

readSignal(“driver_inbox”, 10)

writeSignal(“rider_inbox”, “driver_online”)

channel signal readSignal(“rider_inbox”, 10)

channel

timeout

Signaling - Logical Flow

Test Target

Test Target

signal

signal

Page 13: Uber’s Fascinating World of Inter-App Communications

4/13/16

11

Signaling - Octopus Workflow

Two-way communication Test Target Test Target

Virtual two-way communication Test Target Test Target

Test Host

Signaling in Octopus: File-based Signaling

Test Target (driver)

Test Target (rider)

Test Host

writeSignal(“driver_to_rider”, “driver_arrived”)

“driver_online”

“driver_online”

“driver_online”

Page 14: Uber’s Fascinating World of Inter-App Communications

4/13/16

12

Signaling in Octopus: Interacting with Test Host

•  How to send a file/string from test target to test host? writeSignal

•  How to watch a file on test host from test target? readSignal

Octopus - Signaling on iOS

•  UIAHost.performTaskWithPathArgumentsTimeout The equivalent of “exec()”

•  writeSignal: exec(“echo ${signal} > ${signal_file}”) •  readSignal: exec(“cat ${signal_file}”)

Page 15: Uber’s Fascinating World of Inter-App Communications

4/13/16

13

Octopus - Signaling on Android

•  Unfortunately, there’s no direct “exec()”. Everything should be initiated from test host.

•  We use “adb shell” as relayer.

•  readSignal: “adb pull”

•  writeSignal: “adb push”

Octopus Demo #2 (UberPool)

Page 16: Uber’s Fascinating World of Inter-App Communications

4/13/16

14

Octopus Evolution (Hermetic Tests)

Page 17: Uber’s Fascinating World of Inter-App Communications

4/13/16

15

New Octopus Challenge: Making the tests stable

Want stable tests to guard against our builds Solution: •  Network record/replay •  Record mode:

•  Records the network responses •  Replay mode:

•  Plays back the network responses from cache

Octopus Evolution (Image Diffing)

Page 18: Uber’s Fascinating World of Inter-App Communications

4/13/16

16

•  Perceptual diff •  Post-processors (thresholds)

{ "app_name": "rider", "test_name": "com.ubercab.tests.rider.AppLaunchTest#testSignInScreenshot", "post_processors": [ ["ImageDiffPipeline", {"threshold": 5000}] ] }

New Octopus Challenge: Image diffing

Octopus Evolution (Locale Testing)

Page 19: Uber’s Fascinating World of Inter-App Communications

4/13/16

17

New Octopus Challenge: Locale Testing What is it & Why? •  Localization can mean many things besides Translation:

‐  Date/time format ‐  Number format ‐  Currency ‐  Text direction ‐  Encoding etc..

•  Why? -> Hotfixes ‐  Chinese users see English UI ‐  Hebrew/Arabic users unable to request a ride ‐  Crashes for users from certain regions ‐  Layout/encoding issues

Locale Testing: Our Octopus Solution

•  Test buddy app: Set the locale/network country ISO on simulators/emulators/devices

•  Ability to loop thru different locales for a test, and upload the results to our test results repository

•  Test related ‐  Test should be locale agnostic

▪  text as UI element identifier ▪  text as verifications

‐  Logic should be locale agnostic ▪  some features are not available in all countries ▪  flows may be different etc...

Page 20: Uber’s Fascinating World of Inter-App Communications

4/13/16

18

Sign-in Test (run against 35 locales) for android rider app Test artifacts (logs, video recording, screenshots) for each locale is stored in its own folder on Jenkins.

Questions?

Page 21: Uber’s Fascinating World of Inter-App Communications

4/13/16

19

Presented by: Apple Chow & Bian Jiang

Special thanks to mobile-test-infa@, octopus-eng@, mobile-eng@ and all the amazing people at Uber :) Uber eng blog: https://eng.uber.com/rescued-by-octopus/

Come join us: https://www.uber.com/careers/list/13540