相关疑难解决方法(0)

如何在maven中的集成测试目标中运行单个测试

我们为maven中的集成测试阶段生命周期定义了数百个测试,并且需要很长时间才能完成.

我想要做的只是运行一个测试integration-test.我试过做:

mvn -Dtest=<my-test> integration-test
Run Code Online (Sandbox Code Playgroud)

但这不起作用.将-Dtest只运行在单元测试目标测试,而不是集成测试阶段.我试过了-Dintegration-test=<my-test>,但是被忽略了.

有没有办法做到这一点 ?


我的配置是:

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <executions> 
        <execution> 
            <id>surefire-it</id> 
            <phase>integration-test</phase> 
            <goals> 
                <goal>test</goal> 
            </goals> 
            <configuration> 
                <excludes> 
                    <exclude>none</exclude> 
                </excludes> 
                <includes>
                    <include>**/api/**</include> 
                </includes> 
    ..... 
Run Code Online (Sandbox Code Playgroud)

integration-testing maven-2 maven-surefire-plugin

42
推荐指数
4
解决办法
3万
查看次数