mercredi 3 août 2016

JUnit Suite with a collection of classes

I have several project modules and their test modules in my project. I want to make a single test module which has test suites(Suite.class) for each test module including all its test classes and then run these suite tests from within that module using JUnitCore on different threads. How can I achieve this ?

I know that JUnit Suites work like :

@RunWith(Suite.class)
@Suite.SuiteClasses({
        TestJunit1.class ,TestJunit2.class
})

where we have to give a comma separated list of classes in order to incorporate it into a suite. How can I go through a testing module (package) programmatically and get all its classes (objects) and make a list out of that (Class) and then eventually make a test suite from this list?

Aucun commentaire:

Enregistrer un commentaire