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.
It works with TestNG as well. Your test class needs to extend one of the following classes:
org.springframework.test.context.testng.AbstractTestNGSpringContextTestsorg.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTestsIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With