整合測試(Integation Testing)和單元測試(Unit Testing)的差別在哪裡?
What type of designs are needed to write integration test cases?
http://www.michaeldkelly.com/blog/archives/265
April 26th, 2009
Posted by Mike Kelly
Published in Mike Kelly’s blog
很多人會問到unit testing做完之後, 為何還要做integration testing? 或者是unit testing 和integration testing之間的差別在哪裡? 我當初的答案是, 其實這兩個測試是差不多的. 之所以會在integration testing中找到unit testing所找不到的問題, 通常是你在unit testing中沒有測試這項資料或流程. 如果你有測試, 應該大部分的狀況是不會出錯的.
但是後來我修正了一下我的答案, 那就是即使你有測過這項資料或流程還是不夠的, 因為你只是確認了你自己做的對不對, 也就是do the thing right. 但是並不代表你做的對的東西, 就是別人要的東西, 也就是不一定是do the right thing. 因此, integration testing的另一個重點是確認彼此之間的protocol是否正確.
後來, 看到這篇文章, 作者和我有類似想法. 要確認units之間的protocol, 要確認它的標準是什麼, 然後才可以開個案進行測試.
以下是作者覺得在開立integration testing測試個案時, 要考慮的方向
(1) my understanding of the business problem trying to be solved.
(2) conversations about the functionality with other people on the project team.
(3) design documents for the components, the integration or the system in general.
(4) mapping documents or data-flow diagrams that show how information is moved through the components and what transformations take place.
(5) state diagrams that show what events take place and when.
(6) database, XML and other data schemas used in the process.
(7) other testing I’ve done or reviewed (at the unit level or system level).
(8) other similar types of integration I’ve worked with on past projects.
(9) and the very last integration test case I’ve executed (because I’m always thinking of new tests as I’m executing tests).
留言列表