Test Code必須和Dev Code 的開發一樣嚴謹

Test Code Must Be As Solid As Dev Code
http://blogs.msdn.com/steverowe/archive/2008/08/07/test-code-must-be-as-solid-as-dev-code.aspx

Test Code要能有用, 必須要和開發Dev Code一樣, 要有相同的process和警慎的心態. 否則Test Code將會充滿bug, 無法經得起長時間使用.

最近公司有一份survey 公司和Microsoft test automation的比較. 發現到Microsoft真的很嚴謹在看待test automation:
(1) 認為auto test implementation process 和 development process一樣重要
(2) 有專門的 test automation team.
(3) 要求QA 和RD要加入
(4) test code 也有明確 development phrase
(5) testing script也需要做code review
(6) 有大量的輔助系統來管理和deploy test automation system (Bug tracking system, source control system, log praser, build deployment system, test data management system...)

當下是覺得他們是下很大的工夫, 在落實test automation的進行. 做的是比我們還好很多. 我們只是有, 但是分工還是沒有很細緻, 還是停留在土法大煉鋼的時代. 至少我認為有以下缺點
1. 只靠QA 或少部分的test developer在做開發
2. RD很少加入討論或是提供現成的工具或程式, testability的修改更是少數
3. 並沒有採用像dev process一樣的輔助工具: bug tracking syste, log parser, build deployment, source control system. 即使有用, 但是也不嚴謹. 總是自己認為是Test Code, 心態上就隨便許多
4. 沒有套用code review, design review, architecture design, unit test等這些pratices, 到Test Code身上.
5. 更不用講project management
......
反正只要能交的出來就好, 怎麼做不是重點.

後來在網路上看到"Test Code Must Be As Solid As Dev Code"這篇時, 發現 Microsoft的員工認為他們還是有進步的空間, 他們也認為他們還是沒有像dev code那樣的嚴謹. 他是列出一些Test Code常見的問題,
1. Flaky test code can make determining the source of an error difficult.  
- Tests that cannot be trusted make it hard to convince developers to fix issues.  
- No one wants to believe there is a bug in their code so a flaky test becomes an easy scapegoat.

2. Spurious failures take time to triage.  
- Test cases that fall over because they are unstable will take a lot of time to maintain.  
- This is time that cannot be spent writing new test automation or testing new corners of the product.

3. Poorly written test code will hide bugs in the product.  
- If test code crashes, any bugs  in the product after that point will be missed.  
- Similarly, poor test code may not execute as expected..  

不過比較好玩的部份, 是後來有人問了問題:
It should be done but sounds like a resource nightmare - "hey boss, we need some testers to test the test code..."
How close are you to getting this to happen at MS ? Any problems in
a) getting a budget for this ?
b) finding enough testers capable of doing it ?

我想resource 這是很多公司很多人都考慮的問題, resource不夠是無法做事的.不過我要講的是, 這也要看公司重不重視. 像我們公司RD 和QA 的比例是1:1, 對台灣很多公司來說, 是有點天方夜譚. 同樣地, 當我們公司在看Microsoft對test automation的作法時, 我們也是會覺得有點天方夜譚. 只能說, 要做到那樣不是不可能, 在於你重不重視.




arrow
arrow
    全站熱搜

    kojenchieh 發表在 痞客邦 留言(0) 人氣()