MOPCON 2015 - Tips of Mobile Continuous Delivery

73
Tips of Mobile Continuous Delivery Anistar Sung

Transcript of MOPCON 2015 - Tips of Mobile Continuous Delivery

Page 1: MOPCON 2015 - Tips of Mobile Continuous Delivery

Tips of Mobile Continuous Delivery

Anistar Sung

Page 2: MOPCON 2015 - Tips of Mobile Continuous Delivery

Anistar sung 宋志峰 APAC Yahoo Engineer Manger

Introduction

Page 3: MOPCON 2015 - Tips of Mobile Continuous Delivery

MOPCON 2013 tech talk deck http://www.slideshare.net/anistarsung/mopcon-share

What I Done in MOPCON 2013

Page 4: MOPCON 2015 - Tips of Mobile Continuous Delivery

MOPCON 2014 tech talk deck http://www.slideshare.net/anistarsung/mopcon-2014-best-software-architecture-in-app-development

What I Done in MOPCON 2014

Page 5: MOPCON 2015 - Tips of Mobile Continuous Delivery

Why we should do testingIs that wasting our time?

Page 6: MOPCON 2015 - Tips of Mobile Continuous Delivery

The following story is inspired by actual events

Page 7: MOPCON 2015 - Tips of Mobile Continuous Delivery
Page 8: MOPCON 2015 - Tips of Mobile Continuous Delivery
Page 9: MOPCON 2015 - Tips of Mobile Continuous Delivery

SOFTWARE TESTING IS NOT OPTIONAL

but it doesn’t have to be a burden

Page 10: MOPCON 2015 - Tips of Mobile Continuous Delivery

High Quality

Fast Delivery

Low Maintenance Cost

Page 11: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery PipelineHow it works with CD pipeline

Page 12: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery (CD) is a software engineering approach in which teams keep producing valuable software in short cycles and ensure that the software can be reliably released at any time.

Continuous Delivery

Wikipedia

“”

Page 13: MOPCON 2015 - Tips of Mobile Continuous Delivery

Automatic execute tasks to deliver production

Continuous Delivery Pipeline

Task A Task B Task C Release

Commit Automation ProductionCandidate

Page 14: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous deliver productions with version control

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Commit A Candidate A

Page 15: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Task A Task B Task C

Commit A Candidate A

Commit B Candidate B

Page 16: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Commit A Candidate A

Each change should trigger next task

Page 17: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Commit A Candidate A

Each change should trigger next task

Page 18: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Commit A Candidate A

Each change should trigger next task

Page 19: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Commit A Candidate A

Each change should trigger next task

Page 20: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Task A Task B Task C

Commit A Candidate A

Commit B Candidate B

Page 21: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Task A Task B Task C

Commit A Candidate A

Commit B Candidate B

Page 22: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C

Commit Automation ProductionCandidates

Task A Task B Task C

Commit A Candidate A

Commit B Candidate B

Page 23: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Commit Automation ProductionCandidates

Task A Task B Task CCommit B Candidate B

Someone should be notified if any part of pipeline fail

Page 24: MOPCON 2015 - Tips of Mobile Continuous Delivery

DemoUsing physical device to be the whistle

Page 25: MOPCON 2015 - Tips of Mobile Continuous Delivery
Page 26: MOPCON 2015 - Tips of Mobile Continuous Delivery

TVBS News Visits Yahoo Office

Page 27: MOPCON 2015 - Tips of Mobile Continuous Delivery

Quality Control

Page 28: MOPCON 2015 - Tips of Mobile Continuous Delivery

Everyone is responsible for the development

Everyone is responsible for the quality

Everyone is responsible for the delivery process

Quality Control

Page 29: MOPCON 2015 - Tips of Mobile Continuous Delivery

Mobile Continuous Delivery PipelineThe strategy of Mobile CD pipeline

Page 30: MOPCON 2015 - Tips of Mobile Continuous Delivery

Continuous Delivery Pipeline

Task A Task B Task C Release

Commit Testing ProductionCandidate

Page 31: MOPCON 2015 - Tips of Mobile Continuous Delivery

Mobile Continuous Delivery Pipeline

Commit Testing ProductionCandidate

CommitStage

AcceptanceTesting

Non-functionalTesting

Build and Test locally

Commit code after passing necessary testing

Page 32: MOPCON 2015 - Tips of Mobile Continuous Delivery

Creating a pull request for your code change

Pre Commit of CD pipeline

Page 33: MOPCON 2015 - Tips of Mobile Continuous Delivery

Pull request should be reviewed by senior developers

DON’T merge it without code review

Pre Commit of CD pipeline

Page 34: MOPCON 2015 - Tips of Mobile Continuous Delivery

Merge if PR can be built successfully and passing test

Pre Commit of CD pipeline

Page 35: MOPCON 2015 - Tips of Mobile Continuous Delivery

Mobile Continuous Delivery Pipeline

Commit Testing ProductionCandidate

CommitStage

AcceptanceTesting

Non-functionalTesting

Build and run Unit Test remotely

Commit Stage should be short and fast

Page 36: MOPCON 2015 - Tips of Mobile Continuous Delivery

Compile source code to build an App

Commit Stage of CD pipeline

Page 37: MOPCON 2015 - Tips of Mobile Continuous Delivery

Writing Unit Test but not like this one

Commit Stage of CD pipeline

Page 38: MOPCON 2015 - Tips of Mobile Continuous Delivery

Using Arrange-Act-Assert pattern to write Unit Test

Commit Stage of CD pipeline

Page 39: MOPCON 2015 - Tips of Mobile Continuous Delivery

Useless unit test sample

Commit Stage of CD pipeline

Page 40: MOPCON 2015 - Tips of Mobile Continuous Delivery

Unit test’s code coverage is important as well

Commit Stage of CD pipeline

Page 41: MOPCON 2015 - Tips of Mobile Continuous Delivery

Mobile Continuous Delivery Pipeline

Commit Testing ProductionCandidate

CommitStage

AcceptanceTesting

Non-functionalTesting

Asserting feature delivery is user expected

Implement Smoke Test and Function Test

Page 42: MOPCON 2015 - Tips of Mobile Continuous Delivery

Smoke Test - Checking foundational function is workable

Acceptance Test of CD pipeline

Page 43: MOPCON 2015 - Tips of Mobile Continuous Delivery

Functional Test - Checking major features is expected

Separated Test Case by priority - P0, P1, P2

Acceptance Test of CD pipeline

Page 44: MOPCON 2015 - Tips of Mobile Continuous Delivery

Writing Test Case for functional test

Acceptance Test of CD pipeline

TC13

Favorite store add

Given User launch the store app When User add a store on store page Then User can view store in favorite store

ID:

Subject:

Description:

Page 45: MOPCON 2015 - Tips of Mobile Continuous Delivery

Writing Test Case for functional test

Acceptance Test of CD pipeline

TC13

Favorite store add

Given User launch the store app When User add a store on store page Then User can view store in favorite store

ID:

Subject:

Description:1

23

Page 46: MOPCON 2015 - Tips of Mobile Continuous Delivery

Acceptance Test of CD pipeline

Given User launch the store app When User add a store on store page Then User can view store in favorite store

Description:1

23

Page 47: MOPCON 2015 - Tips of Mobile Continuous Delivery

Make functional test stable

iOS: AccessibilityAndroid: id

Acceptance Test of CD pipeline

storeBannerstoreTitleitemNum

Page 48: MOPCON 2015 - Tips of Mobile Continuous Delivery

Mobile Continuous Delivery Pipeline

Commit Testing ProductionCandidate

CommitStage

AcceptanceTesting

Non-functionalTesting

Assert App works at non-functional level

Performance Test and Stability Test

Page 49: MOPCON 2015 - Tips of Mobile Continuous Delivery

Performance test - Checking for App’s performance

Cold start time

Refresh time

CPU, Memory, Battery usage

Security

etc

Non-functional Test of CD pipeline

Page 50: MOPCON 2015 - Tips of Mobile Continuous Delivery

Stability test - Checking for App’s stability

Using Monkey Test to probe it

Non-functional Test of CD pipeline

Page 51: MOPCON 2015 - Tips of Mobile Continuous Delivery

Non-functional Test of CD pipeline

Page 52: MOPCON 2015 - Tips of Mobile Continuous Delivery

Making App alive in hard condition:

1. No crash in 5 hours

2. Trigger touch per 100 ms

3. Multiple touchs

4. Keep crazy

5. Avoid dead loop

Non-functional Test of CD pipeline

Page 53: MOPCON 2015 - Tips of Mobile Continuous Delivery

DemoMonkey test in dead loop

Page 54: MOPCON 2015 - Tips of Mobile Continuous Delivery

Permission

Page 55: MOPCON 2015 - Tips of Mobile Continuous Delivery

Jump out

Page 56: MOPCON 2015 - Tips of Mobile Continuous Delivery

Block

Page 57: MOPCON 2015 - Tips of Mobile Continuous Delivery

Key Success Factor for CDBuilding a high quality delivery team

Page 58: MOPCON 2015 - Tips of Mobile Continuous Delivery

Culture is the key factor to success or fail CD

Everyone is responsible for the quality

Plan stories with feature and testing

No accusing, trust members

Inspire innovation in your team

Building success team

Page 59: MOPCON 2015 - Tips of Mobile Continuous Delivery

DemoXingZhe - Testing script generator

Page 60: MOPCON 2015 - Tips of Mobile Continuous Delivery

在沒有很久的很久很久以前, 撰寫功能測試是⼀一件痛苦的事情。

Page 61: MOPCON 2015 - Tips of Mobile Continuous Delivery

當介⾯面設計有所改變時, 必須重新撰寫功能測試。

Page 62: MOPCON 2015 - Tips of Mobile Continuous Delivery

為此,我們從花果⼭山請來了 傳說中的猴⼦子⺩王孫⾏行者

Page 63: MOPCON 2015 - Tips of Mobile Continuous Delivery

透過撰寫Markdown 跟猴⼦子說⼈人話 就可以輕鬆產⽣生測試程式

Page 64: MOPCON 2015 - Tips of Mobile Continuous Delivery

因為寫的是⼈人話 使⽤用版本控制也能輕鬆追蹤修訂

Page 65: MOPCON 2015 - Tips of Mobile Continuous Delivery

簡單⼀一個 $ make

Page 66: MOPCON 2015 - Tips of Mobile Continuous Delivery

就像孫⾏行者拔⽑毛⼀一吹⼀一樣 測試程式就通通產⽣生出來啦!

Page 67: MOPCON 2015 - Tips of Mobile Continuous Delivery

XingZhe - The Monkey King

Page 68: MOPCON 2015 - Tips of Mobile Continuous Delivery
Page 69: MOPCON 2015 - Tips of Mobile Continuous Delivery

SOFTWARE TESTING IS NOT OPTIONAL

but it can be a good helper for quality

Page 70: MOPCON 2015 - Tips of Mobile Continuous Delivery

Anistar Sung APAC Yahoo Engineer Manger

http://www.facebook.com/anistarsung http://blog.riaproject.com

[email protected] [email protected]

More information

Page 71: MOPCON 2015 - Tips of Mobile Continuous Delivery

Yahoo Related Sessions

Anistar R1/R2/R3 SAT 13:00

Harry R2 SAT 14:00

Howard R1 SUN 10:15

Roger R3 SUN 11:15

Tips of Mobile Continuous Deliver

Unleash The Power of Design

Apple Watch 開發

如何建⽴立⾏行動⽣生態圈

Page 72: MOPCON 2015 - Tips of Mobile Continuous Delivery

請到 104 搜尋 “Yahoo奇摩”MOPCON Yahoo 現場攤位 4F

Welcome join us

Page 73: MOPCON 2015 - Tips of Mobile Continuous Delivery

Q + A