I am using Spring 3.0.4 and JUnit 4.5. My test classes currently use Spring tag support with the following syntax:
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration (locations = { "classpath:configTest.xml" }) @TransactionConfiguration (transactionManager = "txManager", defaultRollback = true) @Transactional public class MyAppTest extends TestCase { @Autowired @Qualifier("myAppDAO") private IAppDao appDAO; ... }
I really don't need the TestCase extends string to run this test. This was not needed when running this test class. I had to add extends TestCase to add it to the TestSuite class:
public static Test suite() { TestSuite suite = new TestSuite("Test for app.dao");
If I omit extends TestCase , my test suite will not start. Eclipse will mark suite.addTestSuite (MyAppTest.class) as an error.
How to add test kit Spring 3+? I am sure there is a better way. I am GOOGLED and read the docs. If you do not believe me, I am ready to send you all my bookmarks as evidence. But in any case, I would prefer a constructive answer. Many thanks.
spring junit testing
chris
source share