I have multiple instances of junit.framework.TestCase classes that contain various testcases. I want to write a program that runs particular testcases from these instances.
Is there a way to dynamically invoke junit tests, similar to the invoke()
method from java.lang.reflect API?
As it's not really clear what you want to achieve. Find below some more general possiblities. If you are using Maven you could
(for more examples/possiblities see maven-surefire-plugin: single-test)
mvn -Dtest=YourClass* test
(for more examples/possiblities see maven-surefire-plugin: JUnit_Categories)
mvn test -Dgroups="your.test.group.Example"
edit For ivy
this SO post how-to-run-all-junit-tests-in-a-category-suite-with-ant might help to solve youre requirement.