Re: [心得] 為什麼軟體開發者需要在意軟體品質指標

看板Soft_Job作者 (華麗的天下無雙)時間12年前 (2012/05/28 21:06), 編輯推噓12(120119)
留言131則, 17人參與, 最新討論串15/20 (看更多)
※ 引述《TonyQ (自立而後立人。)》之銘言: : ※ 引述《semop (semop)》之銘言: : : 看來看去,明明從頭到尾就是在講 unit test 的 automation 啊。 : : test case 到底是哪來的名詞? : : 我覺得這根本就像是知道了一個"新"方法,然後就狂熱提倡的言論, : : 還真以為我們這種老人不知道啊? : 我說得其實是「寫test-case」這件事情。 : 不用 automatic tests 是因為他不見得需要 automatic test , : 很多時候我們是手動 trigger 這些 test。 : 不用 unit-test 是因為還有 integration test, : 所以挑了一個比較中性的詞「寫test-case」來說。 : 當然,如果你看不懂這個詞,我可以再定義清楚一些, : 寫「用程式可以跑得測試」。 隨便用Google查一下都可以查到成千上百個Test Case的定義,我附在最後面你可以 自己看,也許它們之間有點差距,但絕對不會是像你定義的這樣子。 最簡單最簡單的來說, 「Test Case是一組已經定義好的輸入、輸出以及操作步驟,提供測試者用已確認程式 是否如常運作。」 Test Case可以Manual Test或Automation Test,Manual Test就是透過人工操作所有的 測試步驟,而Automation Test就是透過程式自動化所有的操作步驟,另外還有比較少人 提到的半自動測試,就是混和自動化測試以及人工測試,跟是不是用程式跑得毫無關係。 絕大部分的Test Case都是文件化的東西。「Write test case」是寫測試案例文件 或是腳本,他的產物是Excel、Word,或是另外某些管理Test Case的工具(ex silktest) Write automation test case才是寫自動化測試案例。你用Google查圖片甚至還有Sample 給你看,什麼叫做「寫Test Case」。 在某些公司有QA,Test Develper的編制,QA負責撰寫Test Case,而Test Develper 將測試案例自動化,不是所有的Test Case都有自動化的價值,這跟自動化的ROI有關 ,由於有時間與資源的限制,Automation Test不是萬靈丹,這個我若有空會談如何 評估Test Case的ROI。 unit test跟integration test是「測試階段/範圍」兩者之間沒有任何衝突。 unit test針對的是程式碼層級。 integration test是系統層級。 Test Case一般也是指integration test層級的測試,不過少數也會用在unit test層級 上面。 Automation Test一般是用在integration test層級的測試。 Test Case(測試案例) from wiki http://en.wikipedia.org/wiki/Test_case A test case in software engineering is a set of conditions or variables under which a tester will determine whether an application or software system is working correctly or not. The mechanism for determining whether a software program or system has passed or failed such a test is known as a test oracle. In some settings, an oracle could be a requirement or use case, while in others it could be a heuristic. It may take many test cases to determine that a software program or system is considered sufficiently scrutinized to be released. Test cases are often referred to as test scripts, particularly when written. Written test cases are usually collected into test suites. Test Script(測試腳本) http://en.wikipedia.org/wiki/Test_script A test script in software testing is a set of instructions that will be performed on the system under test to test that the system functions as expected. There are various means for executing test scripts. Manual testing. These are more commonly called test cases. Automated testing Short program written in a programming language used to test part of the functionality of a software system. Test scripts written as a short program can either be written using a special automated functional GUI test tool (such as HP QuickTest Professional, Borland SilkTest, and Rational Robot) or in a well-known programming language (such as C++, C#, Tcl, Expect, Java, PHP, Perl, Powershell, Python, or Ruby). Extensively parameterized short programs a.k.a. Data-driven testing Reusable steps created in a table a.k.a. keyword-driven or table-driven testing. These last two types are also done in manual testing. http://www.hudong.com/wiki/test+case test case - 基本定义 Test Case 测试用例(Test Case)是为某个特殊目标而编制的一组测试输入、执行条件以及预期结 果,以便测试某个程序路径或核实是否满足某个特定需求。 测试用例(Test Case)目前没有经典的定义。比较通常的说法是:指对一项特定的软件 产品进行测试任务的描述,体现测试方案、方法、技术和策略。内容包括测试目标、测试 环境、输入数据、测试步骤、预期结果、测试脚本等,并形成文档。 test case - 区别 不同类别的软件,测试用例是不同的。不同于诸如系统、工具、控制、游戏软件,管理软 件的用户需求更加不统一,变化更大、更快。 What is Test Case? How to write a good test case? What is Test Case? How to write a good test case? Post to: IpadIt! | digg It! | del.icio.us | Reddit Test Cases are the implementation of a test case design which will help the software tester to detect defects in the application or the system being tested. This should be the primary goal of any test case or set of test cases. When I write a test case, I think of both types of test cases, positive test cases and negative test cases. Positive test cases are those which execute the happy path in the application and make sure that the happy path is working fine. Negative test cases as the name suggests are destructive test cases which are documented with some out-of-box thinking to break the system. A Test Case should be documented in a manner that is useful for the current test cycle and any future test cycles. At a bare minimum each test case should contain: Sr No, Summary or Title, Description, Steps to reproduce, Expected Results, Actual Results and Status of the test case or remarks. Test Case Summary or Title The Summary or title should contain the essence of the test case including the functional area and purpose of the test. Using a common naming convention that groups test cases encourages reuse and help prevents duplicate test cases from occurring. Test Case Description The description should clearly state what sequence of events to be executed by the test case. The Test Case description can apply to one or more test cases; it will often take more than one test case to fully test an area of the application. Test Case Steps to reproduce Each test case step should clearly state the navigation, test data, and events required to accomplish the step. Using a common descriptive approach encourages reuse and conformity. Expected Results of Test Case The expected behavior of the system after any test case step that requires verification / validation - this could include: screen pop-ups, data updates, display changes, or any other discernable event or transaction on the system that is expected to occur when the test case step is executed. Status or Remarks The operational status of the test case - Executed or not executed etc. Also check Test Plan, Defect-Bug, and Status Report -- 所有我的作品,請到..... ~四十八個德瑞克~http://blog.derekhsu.homeip.net 馬皇本紀:http://blog.derekhsu.homeip.net/2009/08/821 上官先生傳:http://blog.derekhsu.homeip.net/2009/08/825 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 175.182.34.146

05/28 21:18, , 1F
理工人看上下文決定一個詞的意義的能力好差啊..
05/28 21:18, 1F

05/28 21:19, , 2F
專有名詞就是專有名詞,還有在用上下文決定的
05/28 21:19, 2F

05/28 21:22, , 3F
來念念社會科學就知道了 每個大師的馬克思都不一樣
05/28 21:22, 3F

05/28 21:36, , 4F
推這篇,理工人本來就講求精準,不要混為一談
05/28 21:36, 4F
※ 編輯: derekhsu 來自: 175.182.34.146 (05/28 21:39)

05/28 21:47, , 5F
不過 T 大講的我看得很順耶, 難道有平行世界 ? XD
05/28 21:47, 5F

05/28 21:48, , 6F
d大發一下test case的ROI啊...這東西真的很難衡量orz
05/28 21:48, 6F

05/28 21:48, , 7F
基本上我覺得只有你看不懂。
05/28 21:48, 7F

05/28 21:48, , 8F
我也嚴重的拒絕你的警告,名詞是用來閱讀的,我可以修改名詞
05/28 21:48, 8F

05/28 21:48, , 9F
、用詞,但這跟你所謂顛三倒四是完全兩回事。
05/28 21:48, 9F

05/28 21:49, , 10F
我的論點完全就是強調用「撰寫 test-case 」的方式可以有效
05/28 21:49, 10F

05/28 21:49, , 11F
降低開發時間,你如果舉不出對這個論點的反駁,你要說我在
05/28 21:49, 11F

05/28 21:49, , 12F
顛三倒四就沒有什麼公信力。
05/28 21:49, 12F

05/28 21:49, , 13F
我必須承認我對測試領域並不算專家,我只是用了三年,但這裡
05/28 21:49, 13F

05/28 21:50, , 14F
並沒有要求要是專家才能發言,我並不排斥你說我不專業,但是
05/28 21:50, 14F

05/28 21:50, , 15F
我想回頭問你,那請拿出你的專業來駁斥我內文論述錯誤的部份
05/28 21:50, 15F

05/28 21:51, , 16F
另外你給出的定義我在 #1FmUa9qQ (Soft_Job) 第四頁就提過了
05/28 21:51, 16F

05/28 21:51, , 17F
別生氣, 有些人覺得 well-defined 比較重要
05/28 21:51, 17F

05/28 21:51, , 18F
test-case 是自己準備好 input - output ,
05/28 21:51, 18F

05/28 21:51, , 19F
去驗證可預期的資料範圍內出什麼事情。
05/28 21:51, 19F

05/28 21:54, , 20F
#1FmUDIQi 你自己翻這篇文章,比把test-case當成什麼
05/28 21:54, 20F

05/28 21:55, , 21F
如果你 test-caes 寫得時候想不到,你「手動測試」時也想
05/28 21:55, 21F

05/28 21:55, , 22F
不到。相對手動測試是自動化測試
05/28 21:55, 22F

05/28 21:55, , 23F
我那篇文章講得一樣是「給定input-output的一種形式」,手動
05/28 21:55, 23F

05/28 21:56, , 24F
測試類比是無亦是的隨意測試。
05/28 21:56, 24F

05/28 21:56, , 25F
就算是自動化測試一樣是一種 test-case 這並無錯誤。
05/28 21:56, 25F

05/28 21:57, , 26F
難道把自動化測試的 unit test 說成 test-case 是錯得?
05/28 21:57, 26F

05/28 21:57, , 27F
integration test 說成是 test-case 是錯得?
05/28 21:57, 27F

05/28 21:57, , 28F
這兩者本就是 test-case 的子集。
05/28 21:57, 28F

05/28 21:58, , 29F
我想你的爭議點是手動測試也可以說是一種測試案例,ok 廣義
05/28 21:58, 29F

05/28 21:58, , 30F
上來說他的確也可以是,那我那句話就可以修改成自動化測試對
05/28 21:58, 30F

05/28 21:58, , 31F
手動測試來得有效率,一樣無損我論點的中心。
05/28 21:58, 31F

05/28 21:59, , 32F
所以我完全看不懂你到底用哪一點來說一個人的文章顛三倒四。
05/28 21:59, 32F

05/28 21:59, , 33F
你還是完全沒有搞清楚
05/28 21:59, 33F

05/28 22:00, , 34F
我想我不需要清楚你的明白。
05/28 22:00, 34F

05/28 22:00, , 35F
^那
05/28 22:00, 35F

05/28 22:00, , 36F
自動化測試跟手動測試是測試案例的執行方法,不是子集
05/28 22:00, 36F

05/28 22:00, , 37F
那你的警告你就自己吞回去吧,因為我看不懂你的意見。XD
05/28 22:00, 37F

05/28 22:00, , 38F
感謝你的意見,但是我覺得那沒什麼參考價值,就醬啦。:P
05/28 22:00, 38F
還有 55 則推文
05/28 22:22, , 94F
你用到Selenium就是Integration Test了...
05/28 22:22, 94F

05/28 22:22, , 95F
所以我不知道你unit test跟integration test到底差在哪裡
05/28 22:22, 95F

05/28 22:23, , 96F
我就說我找不到一個詞同時可以包含 unit-test跟integration
05/28 22:23, 96F

05/28 22:23, , 97F
test。
05/28 22:23, 97F

05/28 22:23, , 98F
我認為這種東西就跟MVC一樣 一種概念各自表述..
05/28 22:23, 98F

05/28 22:23, , 99F
不見得有用到 selenium 就算是 integration test。JSunit
05/28 22:23, 99F

05/28 22:23, , 100F
有一些實作是靠 selenium 作啟動的動作。
05/28 22:23, 100F

05/28 22:24, , 101F
不需要留於空泛的討論名詞定義,那對現實沒有任何意義
05/28 22:24, 101F

05/28 22:24, , 102F
我認為問題是看測試對象是誰。
05/28 22:24, 102F

05/28 22:24, , 103F
我對 unit-test 的認知我覺得還蠻清楚的,unit-test 是單元
05/28 22:24, 103F

05/28 22:24, , 104F
獨立的,所有外界進來的東西都是 mock ,只有測試目標是實的
05/28 22:24, 104F

05/28 22:25, , 105F
MVC有客觀定義啊,怎麼會各自表述, Model都有了
05/28 22:25, 105F

05/28 22:25, , 106F
兩位的寫法我竟然都看得很順,我是不是精神分裂了?
05/28 22:25, 106F

05/28 22:25, , 107F
integration-test 是測試多個模組之間交互運作,selenium
05/28 22:25, 107F

05/28 22:25, , 108F
會被認為是 integration test 是因為他不可避免的製造了
05/28 22:25, 108F

05/28 22:26, , 109F
嗯,我對JSUnit的確不懂,若是這樣確實算是Unit Test
05/28 22:26, 109F

05/28 22:26, , 110F
browser 這個不穩定的外界因素,但是有些環境是用他當載體。
05/28 22:26, 110F

05/28 22:26, , 111F
好啦,要勉強用 nodejs 或 rhino 來講,的確是也可以啦。~_~
05/28 22:26, 111F

05/28 22:30, , 112F
還有你說的隨意測試我想起來了,那叫ad-hoc testing
05/28 22:30, 112F

05/28 22:30, , 113F
good ,多學到一個名詞,謝謝~
05/28 22:30, 113F

05/28 22:32, , 114F
所以你說的是automation testing vs ad-hoc testing
05/28 22:32, 114F

05/28 22:32, , 115F
我重新看過,我還是更正好了。
05/28 22:32, 115F

05/28 22:32, , 116F
我當初想說的應該是 automatic test vs 手動測試沒錯。
05/28 22:32, 116F

05/28 22:33, , 117F
測試名詞有的沒的很多,我之前也不懂,懂了以後卻很難跟
05/28 22:33, 117F

05/28 22:33, , 118F
不知道這些名詞的人溝通
05/28 22:33, 118F

05/28 22:35, , 119F
因為溝通前都得先吵一遍名詞解釋? 呵...
05/28 22:35, 119F

05/28 22:35, , 120F
好吧,從善如流吧,用標準來對話也是好事
05/28 22:35, 120F

05/28 22:43, , 121F
既然已經改了那我也修一下文好了
05/28 22:43, 121F
※ 編輯: derekhsu 來自: 175.182.34.146 (05/28 22:44)

05/28 23:03, , 122F
感謝這篇更正了我的觀念~科學的人就該做科學的事~沒有設立
05/28 23:03, 122F

05/28 23:04, , 123F
共同觀點的討論就像多頭發展的open source一樣難以捉摸...
05/28 23:04, 123F

05/28 23:26, , 124F
MVC有客觀定義?有的話僅止於MVC是什麼的縮寫吧
05/28 23:26, 124F

05/28 23:27, , 125F
對於幾個重要的名詞.有個定義,討論起來才不會整篇都在猜
05/28 23:27, 125F

05/28 23:27, , 126F
光是web的後端MVC跟前端MVC的View的能力就完全不同
05/28 23:27, 126F

05/28 23:38, , 127F
偷偷的說:我的前後台 view 能力都相同(快閃人免得被轟)
05/28 23:38, 127F

05/28 23:49, , 128F
推~ 這篇對於test case定義說得很清楚.
05/28 23:49, 128F
※ 編輯: derekhsu 來自: 175.182.34.146 (05/29 00:55)

05/29 03:21, , 129F
推用標準, 標準真的很重要, 沒有標準則溝通會很沒效率
05/29 03:21, 129F

05/29 11:38, , 130F
感覺兩邊的觀點都還蠻不錯的, 只是彼此都在捍衛彼此的觀點,
05/29 11:38, 130F

05/29 11:39, , 131F
流於爭吵了~ 不然兩邊都有蠻重要東西的說~
05/29 11:39, 131F
文章代碼(AID): #1FmtXDEM (Soft_Job)
討論串 (同標題文章)
完整討論串 (本文為第 15 之 20 篇):
文章代碼(AID): #1FmtXDEM (Soft_Job)