dimanche 20 novembre 2016

In Junit, is there a way I could have a TestSuite that adds a @ClassRule to each test class that is included

For example, I have a test suite as such that collects a bunch of test classes that are listed in CreateObjectTests:

@RunWith(Categories.class)
@ExcludeCategory({
    FailingTest.class,
    VolatileTest.class,
    PermissionTest.class
    })
@Suite.SuiteClasses({
    CreateObjectTests.class
    })
public class CreateObjectTestRunner {}

CreateObjectTests.class uses ClasspathSuite to match maybe 20 different test classes. I want to be able to append a class rule that I have written (log in to CI server and do something) to each of the classes that are aggregated. i.e. I don't want to edit every single test class to add this @ClassRule for it to perform this functionality.

Thanks for your help!

Aucun commentaire:

Enregistrer un commentaire