有没有办法同时运行多个弹簧启动上下文进行集成测试?

时间:2017-02-15 08:50:03

标签: java spring testing spring-boot

我的应用程序中有很多测试类。我使用liquibase来创建我的数据库,使用dbunit来插入数据。我使用testng套装来运行所有测试。当我激活多线程来一起运行所有类时,就会遇到麻烦。

我想在多线程中运行所有测试类,每个测试类必须有它的contexte和它的数据库。

我尝试创建多个spring-datasource.xml,其中我提供了要使用的数据库的信息。所以每个测试类都有它的数据源配置。

这是我的测试课程的负责人。

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = MyApplication.class)
@ContextConfiguration(locations = {
        "/config/datasource/Spring-Datasource2.xml",
    })
@TestExecutionListeners({ DependencyInjectionTestExecutionListener.class,
    DirtiesContextTestExecutionListener.class,
    TransactionalTestExecutionListener.class,
    DbUnitTestExecutionListener.class })

0 个答案:

没有答案
相关问题