android e2e testing at mercari

35
マスター タイトルの書式設定 マスター テキストの書式設定 Vishal Android Test Night #1 Android e2e Testing at Mercari

Upload: vishal-banthia

Post on 23-Jan-2018

2.530 views

Category:

Internet


1 download

TRANSCRIPT

Page 1: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

VishalAndroid Test Night #1

Android e2e Testing at Mercari

Page 2: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定 Software Engineer in Test

Case Study (Mobile Automation)

SWET (past)

Core Member

Vishal Banthia @vbanthia @vbanthia_

Page 3: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Agenda

• About Mercari US Android App• Android UITest Architecture & Design• Continuous Integration

Page 4: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定In June, we had a major update in mercari US app.

mercari US app

Native Native Native React-Native

Not Just UI Changes, but complete architecture shift

Page 5: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定• While deciding new architecture, easy testability was always a priority

• One of the reason to use dependency-injection pattern is above and we use Dagger2 for this. With this, mocking objects is pretty easy and can increase UnitTest coverage

• We always try to keep low-level UnitTest coverage high following Test Pyramid Principle

New Architecture

Note: More technical details can be read here (http://tech.mercari.com/entry/2017/07/19/123443)

Page 6: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

But UITesting is always challengingand was so for US

Page 7: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定• After joining mercari, this was my first big project. Following objectives

were in mind:• Adding new test scenarios and maintaining old ones should be painless• High reliability so that flaky tests are not wasting developers and QA

engineers time• Scalable architecture to minimize test run time• Tests should run on real devices instead of emulators• Minimum operational cost for infrastructure and CI management• Test reports should have all the important information required for

debugging if test fails• Super portable, should be easy to copy for other products

Android UITesting

Page 8: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

UITest High Level Architecture

Ruby

RSpec

AppiumKit

Appium

UIAutomator2

Test Script Automation tool App Under Test

(MercariKit)

Page 9: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

appium_kit (Ruby Library)

A simple ruby gem which extends famous selenium testing ruby library such as Capybara, SitePrism for Appium

Page 10: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Selenium Web Testing in Ruby

selenium-webdriver

capybara watir

site_prism page-object

rspec cucumber test-unit

Page 11: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Quick Overview

● selenium-webdriver is the ruby binding for Selenium

● capybara provides DSL to help writing web tests easily

● page-object design pattern helps in maintaining test easily

● site_prism provides DSL to write pages easily

These libraries have proved themselves for so long, we wanted to use something which we can

rely and can also use same stack for web-testing that is why, simple appium_kit gem.

Page 12: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

appium_kit

selenium-webdriver

capybara

site_prism

rspec

appium-driver

capybara-appium

site_prism

rspec helpers / formatter

appium_kit

Page 13: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

UITest Low Level Architecture

user_profile_spec.rb (rspec)

UserProfilePage < SitePrism::PageUtils

Helpers

Page 14: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Overview

• Pages• All the application related information such as ids, static text etc are tied

with Page Object. Test will talk to application using either helpers or pages. Test can not access application directly.

• 1 Activity ~= 1 Page• Helpers

• Helper binds pages together• Utils

• Utilities such as RandomGen, AdbUtil etc. Not directly related to AUT• Configs

• Static testdata

Page 15: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Running Tests

Page 16: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Rake Tasks

bundle exec download_apk bundle exec rake spec

Environment Variables

● BUILD_NUMBEREnvironment Variables

● ENVIRONMENT

● FEATURES

● ...

Page 17: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Dockerizing UITests

• Dockerizing tests helps in sandboxing environment. • Deploying / Running tests becomes very easy. Do not

need to worry about run environment• Many more benefits …

More Details: https://github.com/vbanthia/appium-docker-demo

Page 18: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Dockerfile

https://github.com/vbanthia/docker-appium

Page 19: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

run_uitest.sh

• Reserve a device on STF• Remote connect• Download apk• Start appium server• Run test

Page 20: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Continuous Integration

Page 21: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Mercari Android CI (Tools & Service)

• Bitrise: To build application• Google Cloud Storage: To store built apks• Google Container Registry: To store docker images• OpenSTF: For Android Device Farm• CircleCI 2.0: Build docker image & run tests in parallel containers• CircleCI Artifacts: To store test reports• AWS Lambda: To trigger nightly builds• Slack: Notification & manual triggers

Page 22: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Application Build Pipeline

Developer Github Bitrise GCS

1. Developer pushes code to Github

2. Github triggers Bitrise

3. Bitrise build app and upload it to GCS

This make sure that we have all the apks

in GCS with their build number linked

Page 23: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

UITest docker image build pipeline

Developer Github CircleCI GCR

1. Developer pushes code to Github

2. Github triggers CircleCI

3. CircleCI build docker image for uitest

and pushed it to google container

registry

This make sure that we have all the

docker image of latest test code any time

Page 24: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

UITest Pipeline

Page 25: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

OpenSTF

Page 26: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Page 27: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

UITests Pipeline

CircleCI Job

AWS Lambda

Slack

Connect remote deviceDownload apk

Run UITests

(device1)

Run UITests

(device2)

Run UITests

(device3)

Test reports

CircleCI Artifact

Page 28: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Benefits

• Everything is on cloud, we only have devices connected to mac-mini which only needs adb to work

• Always ready to run• No need to worry about on-premise infra (Jenkins etc...)

Page 29: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Test Reports

Page 30: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Page 31: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Page 32: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Page 33: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Page 34: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

RSpec HTML Formatter2

● https://github.com/vbanthia/rspec_html_formatter2

● Features:

o Beautiful html report using Bootstrap css/js

o Supports screenshots & screenrecords

Page 35: Android e2e testing at mercari

マスタータイトルの書式設定

• マスターテキストの書式設定

Thank you