171
Continuous Integration in Agile Software Development For Software Quality James.Peng 2016/04/27 http://note.jhpeng.com/

Continuous Integration in Agile Software Development For Software Quality

Embed Size (px)

Citation preview

Page 1: Continuous Integration in Agile Software Development For Software Quality

Continuous Integration in Agile Software Development For Software Quality

James.Peng

2016/04/27

http://note.jhpeng.com/

Page 2: Continuous Integration in Agile Software Development For Software Quality

2

Continuous Integration

Page 3: Continuous Integration in Agile Software Development For Software Quality

3

持續Continuous

有事沒事就來一下

Page 4: Continuous Integration in Agile Software Development For Software Quality

4

整合Integration

結合在一起

Page 5: Continuous Integration in Agile Software Development For Software Quality

5

持續整合Continuous Integration

有事沒事就結合在一起

Page 6: Continuous Integration in Agile Software Development For Software Quality

6

持續整合Continuous Integration

有事沒事就把大家的 Code 結合在一起跑看看有沒有錯

Page 7: Continuous Integration in Agile Software Development For Software Quality

7

持續整合Continuous Integration

有事沒事就把大家的 Code 結合在一起跑看看有沒有錯

可以具體一點嗎?

Page 8: Continuous Integration in Agile Software Development For Software Quality

8

自動化 + 測試 + 系統反饋Continuous Integration

Page 9: Continuous Integration in Agile Software Development For Software Quality

9

自動化 + 測試 + 系統反饋Continuous Integration

目的就是自動化的替軟體品質做把關

Page 10: Continuous Integration in Agile Software Development For Software Quality

10

在 1994 年 首次被提出

Page 11: Continuous Integration in Agile Software Development For Software Quality

11

Continuous Integration

Agile Development 的武功招式之一

Page 12: Continuous Integration in Agile Software Development For Software Quality

12

Agile Development ?

Page 13: Continuous Integration in Agile Software Development For Software Quality

13

先提一下 傳統開發方式

Page 14: Continuous Integration in Agile Software Development For Software Quality

14

1 個月

傳統開發方式Waterfall 瀑布開發

Release

1 週 1 週 1 週1 週

Page 15: Continuous Integration in Agile Software Development For Software Quality

15

1 個月

傳統開發方式Waterfall 瀑布開發

ReleaseWaterfall 瀑布式開發

1 週 1 週 1 週1 週

Page 16: Continuous Integration in Agile Software Development For Software Quality

16

1 個月

傳統開發方式Waterfall 瀑布開發

Release

1 週 1 週 1 週1 週

Page 17: Continuous Integration in Agile Software Development For Software Quality

17

1 個月

傳統開發方式Waterfall 瀑布開發

Release

1 週 1 週 1 週1 週

Page 18: Continuous Integration in Agile Software Development For Software Quality

18

1 個月

傳統開發方式Waterfall 瀑布開發

Release

1 週 1 週 1 週1 週

Page 19: Continuous Integration in Agile Software Development For Software Quality

19

1 個月

傳統開發方式Waterfall 瀑布開發

Release

1 週 1 週 1 週1 週

Page 20: Continuous Integration in Agile Software Development For Software Quality

20

1 個月

傳統開發方式Waterfall 瀑布開發

Release

1 週 1 週 1 週1 週

Page 21: Continuous Integration in Agile Software Development For Software Quality

21

1 個月

傳統開發方式Waterfall 瀑布開發

Release一切順利,功德圓滿

1 週 1 週 1 週1 週

Page 22: Continuous Integration in Agile Software Development For Software Quality

22

1 個月

傳統開發方式Waterfall 瀑布開發

Release今天報告到此結束,謝謝各位

1 週 1 週 1 週1 週

Page 23: Continuous Integration in Agile Software Development For Software Quality

23

1 個月

傳統開發方式Waterfall 瀑布開發

Release但現實世界是殘酷的

1 週 1 週 1 週1 週

Page 24: Continuous Integration in Agile Software Development For Software Quality

Release

24

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問

1 週 1 週 1 週1 週

Page 25: Continuous Integration in Agile Software Development For Software Quality

Release

25

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問現實世界的需求,是複雜的

1 週 1 週 1 週1 週

Page 26: Continuous Integration in Agile Software Development For Software Quality

Release

26

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問是多變的

1 週 1 週 1 週1 週

Page 27: Continuous Integration in Agile Software Development For Software Quality

Release

27

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問是不可預期的

1 週 1 週 1 週1 週

Page 28: Continuous Integration in Agile Software Development For Software Quality

Release

28

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問是抽象模糊的

1 週 1 週 1 週1 週

Page 29: Continuous Integration in Agile Software Development For Software Quality

Release

29

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問是不確定性的

1 週 1 週 1 週1 週

Page 30: Continuous Integration in Agile Software Development For Software Quality

Release

30

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問所以 PLAN 階段,通常是最為重要的

1 週 1 週 1 週1 週

Page 31: Continuous Integration in Agile Software Development For Software Quality

Release

31

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問PLAN 、 PLAN 、 PLAN

1 週 1 週 1 週1 週

Page 32: Continuous Integration in Agile Software Development For Software Quality

Release

32

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問PLAN 擬訂 SPEC

1 週 1 週 1 週1 週

Page 33: Continuous Integration in Agile Software Development For Software Quality

Release

33

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問SPEC 、 SPEC 、 SPEC

1 週 1 週 1 週1 週

Page 34: Continuous Integration in Agile Software Development For Software Quality

Release

34

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問PLAN 的最高境界

1 週 1 週 1 週1 週

Page 35: Continuous Integration in Agile Software Development For Software Quality

Release

35

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問CMMI 軟體能力成熟度模式 Level 5

1 週 1 週 1 週1 週

Page 36: Continuous Integration in Agile Software Development For Software Quality

Release

36

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問一些 Master 和 Mentor 曾經開示我

1 週 1 週 1 週1 週

Page 37: Continuous Integration in Agile Software Development For Software Quality

Release

37

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問文件寫的好,程式沒煩惱

1 週 1 週 1 週1 週

Page 38: Continuous Integration in Agile Software Development For Software Quality

Release

38

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問如果專案失敗的話

1 週 1 週 1 週1 週

Page 39: Continuous Integration in Agile Software Development For Software Quality

Release

39

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問會再制定更詳細的規範及約束文件

1 週 1 週 1 週1 週

Page 40: Continuous Integration in Agile Software Development For Software Quality

Release

40

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問所謂 「按圖施工,保證成功」

1 週 1 週 1 週1 週

Page 41: Continuous Integration in Agile Software Development For Software Quality

Release

41

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問如果專案又再次失敗了的話

1 週 1 週 1 週1 週

Page 42: Continuous Integration in Agile Software Development For Software Quality

Release

42

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問真的不能怪我

1 週 1 週 1 週1 週

Page 43: Continuous Integration in Agile Software Development For Software Quality

Release

43

1 個月

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問一定是你文件沒寫好

1 週 1 週 1 週1 週

Page 44: Continuous Integration in Agile Software Development For Software Quality

Release

44

1 個月3 週1 週

傳統開發方式Waterfall 瀑布開發

需求變變變 時間不夠用 測試被跳過

整合後 Build 不過 很恐怖,不要問內心獨白:不是沒寫好,是根本沒時間寫

Page 45: Continuous Integration in Agile Software Development For Software Quality

45

敏捷開花 ?

Page 46: Continuous Integration in Agile Software Development For Software Quality

46

敏捷開發Agile Development

Page 47: Continuous Integration in Agile Software Development For Software Quality

47

之前逛 Facebook 看到過一句話。

敏捷開發Agile Development

Page 48: Continuous Integration in Agile Software Development For Software Quality

48

在十倍速的時代,不是大的打敗小的、不是強的打敗弱的,是快的打敗慢的。

敏捷開發Agile Development

Page 49: Continuous Integration in Agile Software Development For Software Quality

49

敏捷開發,難道是指把畫押日期提前就叫做敏捷?

敏捷開發Agile Development

Page 50: Continuous Integration in Agile Software Development For Software Quality

50

敏捷開發,難道是指打字速度比較快,換一把機械鍵盤?

敏捷開發Agile Development

Page 51: Continuous Integration in Agile Software Development For Software Quality

51

敏捷開發 =?

Page 52: Continuous Integration in Agile Software Development For Software Quality

52

敏捷開發是一種迭代與增量式開發

Page 53: Continuous Integration in Agile Software Development For Software Quality

53

1 個月

傳統開發方式Waterfall 瀑布開發

Release

1 週 1 週 1 週1 週

Page 54: Continuous Integration in Agile Software Development For Software Quality

54

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

敏捷開發Agile Development

Page 55: Continuous Integration in Agile Software Development For Software Quality

55

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

畫押日期不變,但增加 Sprint 次數

敏捷開發Agile Development

Page 56: Continuous Integration in Agile Software Development For Software Quality

56

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

每個 Sprint 有點類似一次 Mini-Waterfall

敏捷開發Agile Development

Page 57: Continuous Integration in Agile Software Development For Software Quality

57

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

但 這個類似 Mini-Waterfall 的 Sprint

敏捷開發Agile Development

Page 58: Continuous Integration in Agile Software Development For Software Quality

58

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

不是 Waterfall

敏捷開發Agile Development

Page 59: Continuous Integration in Agile Software Development For Software Quality

59

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

沒有 Waterfall 分隔線

敏捷開發Agile Development

Page 60: Continuous Integration in Agile Software Development For Software Quality

60

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

Build 和 Test 是自動化的

敏捷開發Agile Development

Page 61: Continuous Integration in Agile Software Development For Software Quality

61

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

Plan 出的都是一個個 User Story

敏捷開發Agile Development

Page 62: Continuous Integration in Agile Software Development For Software Quality

62

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

User Story 切出的 Task 都有 優先序

敏捷開發Agile Development

Page 63: Continuous Integration in Agile Software Development For Software Quality

63

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

先做優先權高的事

敏捷開發Agile Development

Page 64: Continuous Integration in Agile Software Development For Software Quality

64

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

盡量在 Sprint 裡產出 最小可行性產品

Source : http://www.bnext.com.tw/article/view/id/37675

敏捷開發Agile Development

Page 65: Continuous Integration in Agile Software Development For Software Quality

65

1 個月1 週 1 週 1 週 1 週

FormalRelease

Beta Release

Beta Release

Beta Release

得到 feedback 做出調整,再輪迴一次

Source : http://www.bnext.com.tw/article/view/id/37675

敏捷開發Agile Development

Page 66: Continuous Integration in Agile Software Development For Software Quality

66

舉個淺顯的例子來解釋

明日邊界 Edge of Tomorrow

Page 67: Continuous Integration in Agile Software Development For Software Quality

67

劇透 防雷線

明日邊界 Edge of Tomorrow

Page 68: Continuous Integration in Agile Software Development For Software Quality

68

敏捷開發Agile Development

Rule4 、記憶可以繼承。

Rule1 、 Tom 死了會 Reset 回到出發前的早晨。Rule2 、無論怎麼死,都適用 Rule1 。Rule3 、無法逃離這種循環,除非破關才能從中解脫。

Page 69: Continuous Integration in Agile Software Development For Software Quality

69

敏捷開發Agile Development

有一天湯姆要拯救世界,戰死了

Rule4 、記憶可以繼承。

Rule1 、 Tom 死了會 Reset 回到出發前的早晨。Rule2 、無論怎麼死,都適用 Rule1 。Rule3 、無法逃離這種循環,除非破關才能從中解脫。

Page 70: Continuous Integration in Agile Software Development For Software Quality

70

敏捷開發Agile Development

他發現死了,可以無限次接關重玩。

Rule4 、記憶可以繼承。

Rule1 、 Tom 死了會 Reset 回到出發前的早晨。Rule2 、無論怎麼死,都適用 Rule1 。Rule3 、無法逃離這種循環,除非破關才能從中解脫。

Page 71: Continuous Integration in Agile Software Development For Software Quality

71

而記憶和技能都保留,甚至可以累積。

Rule4 、記憶可以繼承。

Rule1 、 Tom 死了會 Reset 回到出發前的早晨。Rule2 、無論怎麼死,都適用 Rule1 。Rule3 、無法逃離這種循環,除非破關才能從中解脫。

敏捷開發Agile Development

Page 72: Continuous Integration in Agile Software Development For Software Quality

72

於是湯姆透過不斷 Save/Load 大法

Rule4 、記憶可以繼承。

Rule1 、 Tom 死了會 Reset 回到出發前的早晨。Rule2 、無論怎麼死,都適用 Rule1 。Rule3 、無法逃離這種循環,除非破關。

敏捷開發Agile Development

Page 73: Continuous Integration in Agile Software Development For Software Quality

73

累積經驗實力,修正調整攻略

Rule4 、記憶可以繼承。

Rule1 、 Tom 死了會 Reset 回到出發前的早晨。Rule2 、無論怎麼死,都適用 Rule1 。Rule3 、無法逃離這種循環,除非破關。

敏捷開發Agile Development

Page 74: Continuous Integration in Agile Software Development For Software Quality

74

終於破關了。

Rule4 、記憶可以繼承。

Rule1 、 Tom 死了會 Reset 回到出發前的早晨。Rule2 、無論怎麼死,都適用 Rule1 。Rule3 、無法逃離這種循環,除非破關。

敏捷開發Agile Development

Page 75: Continuous Integration in Agile Software Development For Software Quality

75

1 個月1 週 1 週 1 週 1 週

FormalRelease

Tom戰死了Tom 戰死了 Tom戰死了

Tom 重置調整攻略 Tom 重置調整攻略 Tom 重置調整攻略

Tom 贏了

Beta Release

Beta Release

Beta Release

Tom : 野豬騎士來囉

敏捷開發Agile Development

輪迴是累積經驗的最佳方式

Page 76: Continuous Integration in Agile Software Development For Software Quality

76

1 個月1 週 1 週 1 週 1 週

儘快調整 儘快調整 儘快調整TDD TDD TDD

持續整合 持續整合 持續整合 頻繁檢驗 頻繁檢驗 頻繁檢驗

FormalRelease

Source: https://zh.wikipedia.org/wiki/%E6%B5%8B%E8%AF%95%E9%A9%B1%E5%8A%A8%E5%BC%80%E5%8F%91

Beta Release

Beta Release

Beta Release

敏捷開發Agile Development

本次實作重點

Page 77: Continuous Integration in Agile Software Development For Software Quality

本次實作重點

77

1 個月1 週 1 週 1 週 1 週

儘快調整 儘快調整 儘快調整TDD TDD TDD

持續整合 持續整合 持續整合 頻繁檢驗 頻繁檢驗 頻繁檢驗

FormalRelease

Source: https://zh.wikipedia.org/wiki/%E6%B5%8B%E8%AF%95%E9%A9%B1%E5%8A%A8%E5%BC%80%E5%8F%91

Beta Release

Beta Release

Beta Release

中心思想是希望能盡快取得回饋並做出調整

敏捷開發Agile Development

Page 78: Continuous Integration in Agile Software Development For Software Quality

78

So, What’s different

Page 79: Continuous Integration in Agile Software Development For Software Quality

79Source : http://www.slideshare.net/dbMaestro/the-future-of-change-management-and-devops-for-dummies

一次爆發 一次爆發 一次爆發正常能量釋放

正常能量釋放 正常能量釋放

Page 80: Continuous Integration in Agile Software Development For Software Quality

80

小強越晚發現,越碩大肥美

Release

1 個月

傳統開發方式Waterfall 瀑布開發

Page 81: Continuous Integration in Agile Software Development For Software Quality

81

小強越晚發現,越碩大肥美

Release

1 個月

傳統開發方式Waterfall 瀑布開發

下醫治末病

Page 82: Continuous Integration in Agile Software Development For Software Quality

82

來不及長大的小強

1 個月

來不及長大的小強 來不及長大的小強 來不及長大的小強

敏捷開發Agile Development

Page 83: Continuous Integration in Agile Software Development For Software Quality

83

來不及長大

1 個月

來不及長大 來不及長大 來不及長大上醫治未病

敏捷開發Agile Development

Page 84: Continuous Integration in Agile Software Development For Software Quality

84

聽完覺得太遙遠,回到現實世界

Page 85: Continuous Integration in Agile Software Development For Software Quality

85Source: http://www.ithome.com.tw/news/94998

微軟開發平臺事業部全球資深副總裁潘正磊決定從 VS 2012版,要讓開發流程更加敏捷化,來加快產品交付周期,因此決定全面改變微軟研發軟體的流程。數千人參與的 VS 團隊,導入 Scrum 敏捷開發 和 DevOps 思維,將 3 年一次改版步調,加速到每 3周釋出一次小改版

2012 年,微軟開發團隊也敏捷了

Page 86: Continuous Integration in Agile Software Development For Software Quality

86Source: http://www.ithome.com.tw/news/94998

微軟開發平臺事業部全球資深副總裁潘正磊決定從 VS 2012版,要讓開發流程更加敏捷化,來加快產品交付周期,因此決定全面改變微軟研發軟體的流程。數千人參與的 VS 團隊,導入 Scrum 敏捷開發 和 DevOps 思維,將 3 年一次改版步調,加速到每 3周釋出一次小改版

證明這不是我幻想出來的

Page 87: Continuous Integration in Agile Software Development For Software Quality

87

言歸正傳

Page 88: Continuous Integration in Agile Software Development For Software Quality

88Source: http://www.agilemanifesto.org/iso/en/

這次實作的部分

CI Server

Page 89: Continuous Integration in Agile Software Development For Software Quality

89

目前 CI Server 上用到的工具

Page 90: Continuous Integration in Agile Software Development For Software Quality

90

E2E TEST

BUILDSERVER

UNIT TEST

DevOps

Source: https://zh.wikipedia.org/wiki/DevOps

CI Server黑箱

白箱

Page 91: Continuous Integration in Agile Software Development For Software Quality

91

E2E TEST

BUILDSERVER

UNIT TEST

DevOps

Source: https://zh.wikipedia.org/wiki/DevOps

CI Server黑箱

白箱 能抓 BUG 就是好箱

Page 92: Continuous Integration in Agile Software Development For Software Quality

92

E2E TEST

BUILDSERVER

UNIT TEST

DevOps

Source: https://zh.wikipedia.org/wiki/DevOps

CI Server

三個主軸

Page 93: Continuous Integration in Agile Software Development For Software Quality

BUILDSERVE

R

93

情況一:軟體開發階段

Page 94: Continuous Integration in Agile Software Development For Software Quality

94

Build Server每日建置Daily Build / Nightly Build

軟體開發保持高度可見性

Page 95: Continuous Integration in Agile Software Development For Software Quality

95

1 工作天Fast Build

Mail Trigger : Failure

早上 8 點Full Build

Mail Trigger : Always

中午 12 點Full Build

Mail Trigger : Always

下午 18 點Full Build

Mail Trigger : Always

Fast Build

Mail Trigger : Failure

Build Server 的一天日常1.Checkout SVN Code

2.Rebuild Debug

3.Rebuild Release

4.Check Coding Style

5.Static Code Analysis

6.Check Duplicated Code

7.Check Complex Methods

8.Unit Test

9.E2E Test

1.Checkout SVN Code

2.Rebuild Debug

3.Rebuild Release

Page 96: Continuous Integration in Agile Software Development For Software Quality

96

假設功能寫好了 整合看看能不能 build 過

Page 97: Continuous Integration in Agile Software Development For Software Quality

97

乾 哪個白痴誰 Commit 前不先檢查的

Page 98: Continuous Integration in Agile Software Development For Software Quality

98

看一下信箱Server 最近是否 build 的過

Page 99: Continuous Integration in Agile Software Development For Software Quality

99

原來白癡是自己剛剛複製一個 Form 忘記拿掉

Page 100: Continuous Integration in Agile Software Development For Software Quality

100

2 天後

Page 101: Continuous Integration in Agile Software Development For Software Quality

101

功能又寫好了 再次整合看看能不能 build 過

Page 102: Continuous Integration in Agile Software Development For Software Quality

102

又出現錯誤SVN 衝突明明都修正了

Page 103: Continuous Integration in Agile Software Development For Software Quality

103

看一下信箱Server 最近是否 build 的過

Page 104: Continuous Integration in Agile Software Development For Software Quality

104

你麻痺來電一下 IVERSON

Page 105: Continuous Integration in Agile Software Development For Software Quality

105

Commit 收工

Page 106: Continuous Integration in Agile Software Development For Software Quality

106

隔天早上 8 點

Page 107: Continuous Integration in Agile Software Development For Software Quality

107

不穩定 ?

Page 108: Continuous Integration in Agile Software Development For Software Quality

108

CI ServerCode Review 系統反饋使軟體開發透明化

• Coding Style 檢查• 靜態程式碼分析• 重複程式碼分析• 函數複雜度分析• Unit Test 覆蓋率• E2E Test 覆蓋率

Page 109: Continuous Integration in Agile Software Development For Software Quality

109

系統反饋的喜悅

Page 110: Continuous Integration in Agile Software Development For Software Quality

110

檢查 Coding Style

Page 111: Continuous Integration in Agile Software Development For Software Quality

111

靜態程式碼分析

Page 112: Continuous Integration in Agile Software Development For Software Quality

112

重複程式碼分析

Page 113: Continuous Integration in Agile Software Development For Software Quality

113

複雜度分析

Page 114: Continuous Integration in Agile Software Development For Software Quality

114

經過一番修正之後

Page 115: Continuous Integration in Agile Software Development For Software Quality

115

今天又默默的拯救了部門

Page 116: Continuous Integration in Agile Software Development For Software Quality

116

雖然沒有人知道

Page 117: Continuous Integration in Agile Software Development For Software Quality

117

感謝 CI Server 的努力

感謝 CI Server讚嘆 CI Server

Page 118: Continuous Integration in Agile Software Development For Software Quality

E2E TEST

118

情況二:軟體寫好了

Page 119: Continuous Integration in Agile Software Development For Software Quality

119

End-to-End Testing• 模擬使用者和軟體的互動行為• 測試一整個 User Story

Page 120: Continuous Integration in Agile Software Development For Software Quality

120

繁體Win 7 V

上面告訴我要做 E2E 測試

Page 121: Continuous Integration in Agile Software Development For Software Quality

121

繁體 简体 English

Win 7 V

要測 多國語言

Page 122: Continuous Integration in Agile Software Development For Software Quality

122

繁體 简体 English

Win 7 V

Win 8

Win 10

Win XP

要每個 OS 都跑看看

當場不敢回話了

Page 123: Continuous Integration in Agile Software Development For Software Quality

123

功能 A 測試結果

繁體 简体 English

Win 7 (x86) V

Win 8 (x86)

Win 10 (x86)

Win XP (x86)

Win 7 (x64)

Win 8 (x64)

Win 10 (x64)

Win XP (x64)

要包含 x86 x64

當場頭都不敢抬起來了

Page 124: Continuous Integration in Agile Software Development For Software Quality

124

有 20 個測項要測 24平台 *20 測項= 480 次萬一眼神對到,叫我測怎麼辦

Page 125: Continuous Integration in Agile Software Development For Software Quality

125

經過 2 天的不眠不休

20 測項 * 每測項 1 次花 5 分鐘 * 24平台 /60 分鐘 / 24 小時 = 1.67 天 20 測項 * 每測項 1 次花 5 分鐘 * 24平台 /60 分鐘 / 8 小時 = 5 工作天

Page 126: Continuous Integration in Agile Software Development For Software Quality

126

全部測完了測了 480 次

Page 127: Continuous Integration in Agile Software Development For Software Quality

127

全部測完了測了 480 次謎之聲:更新進版後,記得重測

Page 128: Continuous Integration in Agile Software Development For Software Quality

128

全部測完了測了 480 次否則怎能保證加功能後,之前測的沒錯

Page 129: Continuous Integration in Agile Software Development For Software Quality

129

目前版號 V1.0.0.10 版

Page 130: Continuous Integration in Agile Software Development For Software Quality

130

目前版號 V1.0.0.10 版已經累積手動測試 4800 次

Page 131: Continuous Integration in Agile Software Development For Software Quality

131

同時還面臨

Page 132: Continuous Integration in Agile Software Development For Software Quality

132

同時還面臨

寶寶心理苦,可寶寶不說

Page 133: Continuous Integration in Agile Software Development For Software Quality

133

同時還面臨

解決方案

Page 134: Continuous Integration in Agile Software Development For Software Quality

134

同時還面臨

「先維護一下履歷表」

Page 135: Continuous Integration in Agile Software Development For Software Quality

135

思考如何「不讓自己做重複的事」

Page 136: Continuous Integration in Agile Software Development For Software Quality

136

「讓別人做重複的事」

Page 137: Continuous Integration in Agile Software Development For Software Quality

137

「建立軟體自動化測試環境」

Page 138: Continuous Integration in Agile Software Development For Software Quality

138

Page 139: Continuous Integration in Agile Software Development For Software Quality

139

首先,把 20 個「測項」寫成「測試程式」

Page 140: Continuous Integration in Agile Software Development For Software Quality

140

接著放到特定 Share Folder

Page 141: Continuous Integration in Agile Software Development For Software Quality

141

所有虛擬測試平台,會定時自動複製、執行

Page 142: Continuous Integration in Agile Software Development For Software Quality

142

把測試報告寫回特定路徑

Page 143: Continuous Integration in Agile Software Development For Software Quality

143

CI Server 會定時反饋給開發人員

Page 144: Continuous Integration in Agile Software Development For Software Quality

144

你寫的 20隻測試程式

還會收到精美報表

Page 145: Continuous Integration in Agile Software Development For Software Quality

145

你寫的 20隻測試程式把 5 個工作天,縮短為 100 分鐘

還會收到精美報表

20 測項 * 24平台 * 每測項 1 次花 5 分鐘 / 轉為工作天 (60 分鐘 * 8 小時 ) = 5 工作天

20 測項 * 每測項 1 次花 5 分鐘 * 1( 24平台同時自動運行) = 100 分鐘

Page 146: Continuous Integration in Agile Software Development For Software Quality

146

你寫的 20隻測試程式

還會收到精美報表

一天跑一次,一年測 115,200 個測項一年工作天( 12 個月 * 每個月 20 工作天) * 24平台 * 20 測項 =115200 次

Page 147: Continuous Integration in Agile Software Development For Software Quality

147

你寫的 20隻測試程式

還會收到精美報表

需要 5 個專職工程師,一起測 1 年( 一年跑 115200 次 * 每個測項 5 分鐘 ) / 轉為工作天 (60 分鐘 *8 小時 ) / ( 一年工作天 12 月 * 每月 20 天 ) = 5 年

Page 148: Continuous Integration in Agile Software Development For Software Quality

148

1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100

0.00

5.00

10.00

15.00

20.00

25.00

30.00

在 24 個平台上 進行軟體測試一年

手動測試自動測試

測項數量

所需人力20 個測項

需要 5 個專職工程師,一起測 1 年( 一年跑 115200 次 * 每個測項 5 分鐘 ) / 轉為工作天 (60 分鐘 *8 小時 ) / ( 一年工作天 12 月 * 每月 20 天 ) = 5 年

Page 149: Continuous Integration in Agile Software Development For Software Quality

149

1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100

0.00

5.00

10.00

15.00

20.00

25.00

30.00

在 24 個平台上 進行軟體測試一年

手動測試自動測試

測項數量

所需人力40 個測項

葉問 要打 10 個 人

Page 150: Continuous Integration in Agile Software Development For Software Quality

150

1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49 52 55 58 61 64 67 70 73 76 79 82 85 88 91 94 97 100

0.00

5.00

10.00

15.00

20.00

25.00

30.00

在 24 個平台上 進行軟體測試一年

手動測試自動測試

測項數量

所需人力100 個測項

劍一人敵,不足學,學萬人敵 人

Page 151: Continuous Integration in Agile Software Development For Software Quality

UNIT TEST

151

情況三:開發階段、改版或重構時

Page 152: Continuous Integration in Agile Software Development For Software Quality

152

Unit Testing – 單元測試• 針對程式的最小測試單位• 測試對象為單一函式• 獨立,不與其他測試程式碼相依

Page 153: Continuous Integration in Agile Software Development For Software Quality

153

小強越晚發現,越碩大肥美

Release

1 個月

傳統開發方式Waterfall 瀑布開發

當需求變化到要 砍掉重練時 架構大改時

Page 154: Continuous Integration in Agile Software Development For Software Quality

154

小強越晚發現,越碩大肥美

Release

1 個月

傳統開發方式Waterfall 瀑布開發

就要進行 Code Refactoring 重構

Page 155: Continuous Integration in Agile Software Development For Software Quality

155

小強越晚發現,越碩大肥美

Release

1 個月

傳統開發方式Waterfall 瀑布開發

這時候就一定要有 Unit Test

Page 156: Continuous Integration in Agile Software Development For Software Quality

156

這裡就不贅述了

Page 157: Continuous Integration in Agile Software Development For Software Quality

157

What’s Next

Page 158: Continuous Integration in Agile Software Development For Software Quality

158

自動化發行

Page 159: Continuous Integration in Agile Software Development For Software Quality

159Source: https://zh.wikipedia.org/wiki/Scrum

自動化發行 + 自動化發行版測試

Page 160: Continuous Integration in Agile Software Development For Software Quality

160Source: https://zh.wikipedia.org/wiki/Scrum

Scrum+Kanban

自動化發行 + 自動化發行版測試

Page 161: Continuous Integration in Agile Software Development For Software Quality

1612015.03.02

Q&AJames.Peng

http://note.jhpeng.com/

Page 162: Continuous Integration in Agile Software Development For Software Quality

162

Q :哪有美國時間寫 測試程式?

Source: https://youtu.be/8cT_Ulmcrys

Page 163: Continuous Integration in Agile Software Development For Software Quality

163

A: Unit Test 先寫 重點函式 E2E Test 先寫 完美路徑

Page 164: Continuous Integration in Agile Software Development For Software Quality

164

不要迷戀哥 (覆蓋率 100% ) ,哥只是個傳說

Page 165: Continuous Integration in Agile Software Development For Software Quality

165

A:其他的遇到再補就好了

Page 166: Continuous Integration in Agile Software Development For Software Quality

Q :先修 BUG ,還是 先寫測試?

166

Page 167: Continuous Integration in Agile Software Development For Software Quality

167明日邊界 Edge of Tomorrow

A:先寫測試,再修 BUG

Page 168: Continuous Integration in Agile Software Development For Software Quality

168明日邊界 Edge of Tomorrow

A:就可以看到 紅燈 變 綠燈

Page 169: Continuous Integration in Agile Software Development For Software Quality

169明日邊界 Edge of Tomorrow

A:可以避免同樣錯誤不再出現第二遍

Page 170: Continuous Integration in Agile Software Development For Software Quality

170

IT’S DEMO TIME

Page 171: Continuous Integration in Agile Software Development For Software Quality

1712015.03.02

James.Peng

http://note.jhpeng.com/

THANK YOU