java - JUnit4 run all tests in a specific package using a testsuite -
is possible in junit4?
in junit3, following:
public class mytestsuite { public static test suite() throws exception { dobeforeactions(); try { testsuite testsuite = new testsuite(); for(class clazz : getallclassesinpackage("com.mypackage")){ testsuite.addtestsuite(clazz); } return testsuite; } { doafteractions } } ... }
the takari-cpsuite (originally developed johannes link) offers classpath-suite should fit needs. allows filtering of classes in classpath regular expressions like:
import org.junit.extensions.cpsuite.classpathsuite.*; ... @classnamefilters({"mytests.*", ".*test"}) public class mysuite...
Comments
Post a Comment