开发者

Integration/Web Testing with Spring, Hibernate, Selenium

开发者 https://www.devze.com 2023-02-13 13:56 出处:网络
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 sinc

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 
}
0

精彩评论

暂无评论...
验证码 换一张
取 消