【发布时间】:2012-04-27 09:47:49
【问题描述】:
在我的 spring + maven 应用程序中,我已经为数据访问层创建了一些测试,现在我想针对多个数据源运行这些测试。我有类似的东西:
@ContextConfiguration(locations={"file:src/test/resources/testAppConfigMysql.xml"})
public class TestFooDao extends AbstractTransactionalJUnit38SpringContextTests {
public void testFoo(){
...
}
}
目前它已经硬编码了配置位置,因此它只能用于一个数据源。 两次调用测试并通过两个不同配置(比如 testAppConfigMysql.xml 和 testMyConfigHsqlDb.xml)的最佳方法是什么?
我看到了通过系统属性执行此操作的建议。如何告诉 maven 使用不同的系统属性值调用测试两次?
【问题讨论】:
标签: spring testing maven surefire