2011-12-20 15 views
0

如何在jemmy中發射多個測試類http://java.net/projects/jemmy。我嘗試使用這樣的代碼,但它不起作用。它只啓動一個測試。在jemmy中發起多個測試

public class Controller { 
    public static void main(String[] args) { 
     try { 
      Class[] testClasses=AllClassesInPackageFinder.getClasses("test");//finds all classes in package with test. 
      String[] classFullNames= new String[testClasses.length]; 
      for (int i=0; i<testClasses.length; i++){ 
       classFullNames[i]=testClasses[i].getName(); 
      } 
      org.netbeans.jemmy.Test.main(classFullNames); 
     } catch (ClassNotFoundException e) { 
      e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. 
     } catch (IOException e) { 
      e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. 
     } 
    } 
} 

回答

0

你應該用來測試執行的是一個測試工具,如JUnit或TestNG。

傑米不是測試線束本身。

0

如果您創建一個名爲üSuite¨的單獨類,您可以在其中定義測試順序和應執行哪些測試。這裏有一個例子:

public class Suite { 

public static Test suite() { 
    NbModuleSuite.Configuration conf = NbModuleSuite.emptyConfiguration(). 
      addTest(CreateNewProjectTest.class, "testCreateProject"). 
      addTest(AddingElementsTest.class, "testOpenExistingProject", "testOpenTestcase", 
        "testAddElement1", "testAddElement2", "testAddElement3", "testPressOk"). 
      addTest(OtherClassWithSomeTest.class, "test1", "test2", "test3", 
        "test4", "test5", "test6", "test7", "test8"); 

    return conf.clusters(".*").enableModules(".*").honorAutoloadEager(true).suite(); 
} 

}

正如所看到的,可以定義的類的順序(第一次添加的將是第一個執行的)和每類中,可以定義每個順序方法。

相關問題