I have a JUnit suite as follows
@RunWith(value=org.junit.runners.Suite.class)
@SuiteClasses(
value={
AccountDAOImplUnitTest.class,
SessionDAOImplUnitTest.class,
UserDAOImplUnitTest.class,
LicensingEntityDAOImplUnitTest.class,
DomainDAOImplUnitTest.class,
OrganizationDAOImplUnitTest.class,
QuestionDAOImplUnitTest.class,
SurveyAnswerDAOUnitTest.class
}
)
public class DAOUnitTestSuite {
====
test {
println 'Starting the Unit and Integration test'
include '**/*UnitTest*'
include '**/*IntTest*'
include '**/dao/mysql/*TestSuite'
exclude '**/dao/mysql/*UnitTest*'
}
My DAO unit test classes requires to be run using TestSuite because I do some H2 database setup in the @Before of the suite. Since my unit test classes have UnitTest suffix and they depend on TestSuite @Before, I had to exclude the pattern ‘**/dao/mysql/UnitTest’.
When I run the test, none of the DAO tests get executed even though TestSuite is included.