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

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

  • <strong id="5koa6"></strong>
  • 關于 JUnit 測試中某些測試方法的順序信賴性有兩種解決方法

    發表于:2009-04-07來源:作者:點擊數: 標簽:junitJunitJUnitJUNIT
    關于 JUnit 測試中某些測試方法的順序信賴性有兩種解決方法: (但是怎么結果并沒有達到我要的效果,我希望如果前面的測試失敗,則后面的所有有信賴于這個測試的測試都失?。?(1) 為每個測試類添中一個 suite() 方法 public static Test suite() { TestSuit
    關于 JUnit 測試中某些測試方法的順序信賴性有兩種解決方法:
    (但是怎么結果并沒有達到我要的效果,我希望如果前面的測試失敗,則后面的所有有信賴于這個測試的測試都失?。?

    (1) 為每個測試類添中一個 suite() 方法
     public static Test suite() {
      TestSuite suite = new TestSuite("edu.dhu.zkl.tools.FileSwithWithMemoryTest");
     
      // 下面添加測試方法的順序即使 JUnit 運行測試的順序
      suite.addTest( new FileSwithWithMemoryTest( "testLoadFileIntoMemory" );
      suite.addTest( new FileSwithWithMemoryTest( "testStoreMemoryIntoFile" );
     
      return suite;
     }
     
        但是這種方法要將 FileSwithWithMemoryTest 中所有的測試方法都添加進來,當 FileSwithWithMemoryTest 中
    測試方法多,而要指定有序的測試方法少時,則讓人感到厭煩。

        下面第(2)種方法是一個不錯的選擇
    (2) 為每個測試類添中一個 suite() 方法
     public static Test suite() {
      String[] orderDependentTests = new String[] {
       "testLoadFileIntoMemory",
       "testStoreMemoryIntoFile"
      };
     
      return new OrderdTestSuite(
       FileSwithWithMemoryTest.class, orderDependentTests );
     }
     
        這種方法要用到 GSBase jar包(Mike Bowler)

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品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>