2012-06-26 61 views
0
Class A { 

    @Test  
    @CustomAnnotation(attrib1 = "foo"; attrib2 = "moo"; attrib3 = "poo") 
    void methodA(){ } 

    @Test  
    @CustomAnnotation(attrib1 = "blahblah"; attrib2 = "flahflah"; attrib3 = "klahklah") 
    void methodB(){ } 

    @Test  
    @CustomAnnotation(attrib1 = "foo"; attrib2 = "flahflah"; attrib3 = "poo") 
    void methodC(){ } 
} 

,使用反射,我的批註處理類將返回我的符合我的標準,哪些方法(比如,attrib1 =「富」)一SET/LIST - 方法A和方法C將滿足。現在我需要在運行時將這些添加到測試套件並運行它。如何在運行時創建一個測試套件現在

如何將它們添加到測試套件?

+1

也許在JUnit中有一個功能,它可以做你想做的事情:http://kentbeck.github .com/junit/javadoc/latest/org/junit/experimental/categories/Categories.html –

+0

從實驗到穩定:https://github.com/junit-team/junit4/wiki/Categories –

回答

相關問題