小编jfu*_*jfu的帖子

maven:针对不同的配置运行相同的测试

在我的spring + maven应用程序中,我已经为数据访问层创建了一些测试,我现在希望针对多个数据源运行.我有类似的东西:

@ContextConfiguration(locations={"file:src/test/resources/testAppConfigMysql.xml"})
public class TestFooDao extends AbstractTransactionalJUnit38SpringContextTests {
  public void testFoo(){
     ...
  }
} 
Run Code Online (Sandbox Code Playgroud)

它目前的配置位置是硬编码的,因此它只能用于一个数据源.调用测试两次并传递两个不同配置的最佳方法是什么(比如testAppConfigMysql.xml和testMyConfigHsqlDb.xml)?

我已经看到过通过系统属性执行此操作的建议.如何告诉maven使用不同的系统属性值调用两次测试?

testing spring surefire maven

5
推荐指数
1
解决办法
1473
查看次数

标签 统计

maven ×1

spring ×1

surefire ×1

testing ×1