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(){ }
}

Now, using reflection, my annotation processing class will return me a SET/LIST of methods which match my criteria (say,attrib1="foo") - Method A and method C will satisfy. Now I need to add these to a test suite at runtime and run that.

How can I add them to the test suite?

luketorjussen
  • 3,156
  • 1
  • 21
  • 38
quantumcrypt
  • 523
  • 1
  • 4
  • 5

1 Answers1

0

Have a look at org.junit.runner.JUnitCore. You should be able to specify the set of tests to run (methods that have to be executed as tests) using org.junit.runner.Request: http://junit.sourceforge.net/javadoc/org/junit/runner/JUnitCore.html#run(org.junit.runner.Request)

david a.
  • 5,283
  • 22
  • 24