您的位置:軟件測(cè)試 > 開(kāi)源軟件測(cè)試 > 開(kāi)源單元測(cè)試工具 > junit
JUNIT測(cè)試通過(guò)的HelloWorld
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:[ 2013/1/15 14:46:26 ] 推薦標(biāo)簽:

<中間休息^_^>


下面請(qǐng)把 com/company/HelloWorld.java文件中的return "Hello World!";改成return "Hello world!!",并在../JunitTest/builde目錄運(yùn)行下運(yùn)行ant runtests。
我們會(huì)看到如下情形:
……………………………………
……………………………………
runtests:
[junit] .F
[junit] Time: 0.01
[junit] There was 1 failure:
[junit] 1) testSayHello(test.com.company.HelloWorldTest)junit.framework.Comp
arisonFailure: expected:<...World...> but was:<...world!...>
[junit] at test.com.company.HelloWorldTest.testSayHello(Unknown Source)
[junit] at sun.reflect.NativeMethodAclearcase/" target="_blank" >ccessorImpl.invoke0(Native Method)
[junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)

[junit] FAILURES!!!
[junit] Tests run: 1, Failures: 1, Errors: 0
BUILD FAILED


我們可以看到,這是JUNIT測(cè)試用例未正常運(yùn)行通過(guò)的錯(cuò)誤信息。

上一頁(yè)123下一頁(yè)
軟件測(cè)試工具 | 聯(lián)系我們 | 投訴建議 | 誠(chéng)聘英才 | 申請(qǐng)使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd