是否可以使用加载的弹簧上下文运行测试套件,像这样
@RunWith(Suite.class)
@SuiteClasses({ Test1.class, Test2.class })
@ContextConfiguration(locations = { "classpath:context.xml" }) <------
public class SuiteTest {
}
上面的代码显然行不通,但是有什么办法可以完成这种行为吗?
这是目前在我的测试套件中使用弹簧上下文的方式:
@BeforeClass
public static void setUp() {
final ConfigurableApplicationContext context =
loadContext(new String[] { "context.xml" });
jdbcTemplate = (JdbcTemplate) context.getBean("jdbcTemplate");
// initialization of other beans...
}