views:

262

answers:

1

Spring support JUnit quite well on that: With the RunWith and ContextConfiguration annotation, things look very intuitive

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:dao-context.xml")

This test will be able to run both in Eclipse & Maven in correctly. I wonder if there is similar stuff for TestNG. I'm considering moving to this "Next Generation" Framework but I didn't find a match for testing with Spring.

+2  A: 

It works with TestNG as well, you need to subclass org.springframework.test.context.testng.AbstractTestNGSpringContextTests or org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests.

lexicore
Thanks. That's exactly what I'm looking for.
Phương Nguyễn