I donβt think it can be defined globally, but if you write your own main function, you can do something similar with code. You can create a custom RunnerBuilder and transfer it to the Suite along with your test classes.
Class<?>[] testClasses = { TestFoo.class, TestBar.class, ... }; RunnerBuilder runnerBuilder = new RunnerBuilder() { @Override public Runner runnerForClass(Class<?> testClass) throws Throwable { return new MyCustomRunner(testClass); } }; new JUnitCore().run(new Suite(runnerBuilder, testClasses));
This will not integrate with UI testing runners, as in Eclipse, but for some automated testing scenarios this might be an option.
source share