RunWith
Spring supports JUnit very well in this way: With the and annotations ContextConfiguration
, the code is very intuitive
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:dao-context.xml")
This test is available to run both with Eclipse and Maven correctly. I wonder if something similar can be done with TestNG. I'm considering migrating my tests to this framework , but I haven't found a way to extrapolate these tests with Spring, from Junit to TestNG.
This way it finally worked: