相依與覆蓋率快樂表

Li-Hsuan Chen
Jul 24, 2017 · 1 min read

惡名昭彰(?)的相依,這個很多人在提。
「他有什麼不好?」的其中一點回答最近還滿有體會的


那就是「覆蓋率不準確」吧


測試的覆蓋率算是評估一分程式碼是否可靠的其中一個指標,
那為什麼相依為什麼會讓覆蓋率不準確呢?


Xcode 裡面,只要在測試有被執行到的程式碼,就會被計入覆蓋率有被測到的那一邊。這樣測完一份 code 之後,就會營造「好像有滿多地方涵蓋到了」的錯覺。

從數字上那個報表變成了一個快樂表,實質上因為還沒有被測過、被保證過沒問題的部分,因此會變成了「沒有問題的一方」。

這樣的話,對軟體的品質保證是很危險的。

(尤其我現在待的公司是提供跟錢有關係的服務)

Li-Hsuan Chen

Written by

An iOS engineer who came from Changhua, Taiwan and located in Tokyo right now. Interested in architecture design, UI/UX design and cross domain things.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade