Integration/Web Testing with Spring, Hibernate, Selenium
I'm writing Integration tests for a webapp using Spring AbstractJUnit tests and Hibernate for data setup. I have Builders using Hibernate which is more convenient than DbUnit for data setup. But since Hibernate transactions are not committed by Spring tests, data is not visible to the actual webapp outside of the Integration test environment. Is there any way to overcome this issue and use Spring to force data setup by Hibernate to be committed to database before testing the webapp? This looks like a common problem to me, but all i could find was Spring's Transactional suppo开发者_JAVA百科rt for Unit tests
Spring rollback test method transaction by default. Annotate your test methods with @Rollback(false).
@Test
@Rollback(false)
public void testMarkerMethod() {
// data setup
}
精彩评论