2012-06-26 60 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 –

回答

相关问题