【发布时间】:2012-01-20 01:54:40
【问题描述】:
我们有一堆 JUnit 测试用例(集成测试),它们在逻辑上被分组到不同的测试类中。
我们能够为每个测试类加载一次 Spring 应用程序上下文,并将其重新用于 JUnit 测试类中的所有测试用例,如 http://static.springsource.org/spring/docs/current/spring-framework-reference/html/testing.html 中所述
但是,我们只是想知道是否有一种方法可以为一堆 JUnit 测试类只加载一次 Spring 应用程序上下文。
FWIW,我们使用 Spring 3.0.5、JUnit 4.5 并使用 Maven 构建项目。
【问题讨论】:
-
下面的所有答案都很棒,但我没有 context.xml。我是否已经注释掉了我的遗忘方式?没有 context.xml 有什么方法可以做到这一点?
-
您找到解决方案的答案了吗?我有同样的问题,我想用注释和 Spring Boot 来完成。
标签: spring junit junit4 spring-test