mercredi 11 juillet 2018

Junit running all tests at once with custom rule

I need to add a custom rule for my test suite. I have tested the rule in an individual test class and it works, but there are 100+ classes which constantly increase so that would not be a solution for me. I am able to run all the tests using a ClasspathSuite runner, but when I am declaring my rule, it's not being taken into consideration at all.

 @RunWith(ClasspathSuite.class)
 @SuiteTypes({ JUNIT38_TEST_CLASSES, TEST_CLASSES })
 public class Tests {
    @Rule
    RetryRule retryRule=new RetryRule(3);
    public static void main(String args[]) {
        JUnitCore.runClasses(Tests.class);
        }
    }

Has anyone else encountered this before? Thanks

Aucun commentaire:

Enregistrer un commentaire