Yes it is possible. The easiest way for me is to add a test suite class. It might look like this:
package tests; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import tests.message.ATest; import tests.validator.BTest; import tests.validator.CTest; import tests.validator.DTest; @RunWith(Suite.class) @SuiteClasses({ ATest.class, BTest.class, CTest.class, DTest.class }) public class AllTests { }
This will allow you to test any imported class no matter what package it is in. To run this in eclipse, you just right-click the AllTests class and run it as a JUnit test. Then it will run all the tests you define in @SuiteClasses .
This will work with related sources, I use it all the time.
span Feb 17 '13 at 16:12 2013-02-17 16:12
source share