• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • Myeclipse中如何進行JUnit單元測試?(3)

    發表于:2016-10-28來源:冷血之心的博客作者:冷血之心點擊數: 標簽:MyEclipse
    testAddNum () {Test1 ts= new Test1();ts.addNum( 3 , 6 );} @After public void testm2 () {Test1 ts= new Test1();ts.method2();} @Ignore public void testm3 () {Test1 ts= new Test1();ts.method3();} @Before
    testAddNum(){ Test1 ts=new Test1(); ts.addNum(3, 6); } @After public void testm2(){ Test1 ts=new Test1(); ts.method2(); } @Ignore public void testm3(){ Test1 ts=new Test1(); ts.method3(); } @Before public void testm4(){ Test1 ts=new Test1(); ts.method4(); } }

    如何運行?

     

    方法1:在測試方法類中,我們可以選中某個方法比如testm3,選擇Run as ---->JUint Test

    方法2:將整個測試類運行,選擇Run as ---->JUint Test

    結果如何?

    如圖出現綠條說明方法測試成功。

    按照上邊的代碼,在Console中將出現如下結果:

    即標有Ignore的測試方法沒有被執行,Before和After方法分別在Test方法之前和之后執行了一次。

    原文轉自:http://blog.csdn.net/qq_25827845/article/details/52132596

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>