我可以根据IntegrationTest的名称设置工作目录吗?

时间:2017-02-03 00:25:02

标签: maven junit integration-testing maven-failsafe-plugin

我的maven-failsafe-plugin配置如下:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.19.1</version>
    <executions>
        <execution>
            <id>integration-test</id>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
            <phase>integration-test</phase>
            <configuration>
                <excludes>
                    <exclude>none</exclude>
                </excludes>
                <includes>
                    <include>**/*IntegrationTest.java</include>
                </includes>
                <workingDirectory>${project.build.directory}/integration-test/</workingDirectory>
                <skipTests>${skipITs}</skipTests>                    

             </configuration>
        </execution>
    </executions>
</plugin>

现在我想要做的是,我的每个集成测试都运行在目标文件夹的不同目录中 - 这样我就可以检查每个目录的日志记录。

这是可能的 - 例如:

<workingDirectory>${project.build.directory}/integration-test/${integration.test.name}</workingDirectory>

1 个答案:

答案 0 :(得分:1)

您可以将redirectTestOutputToFile设置为true以将输出重定向到每个测试的文件,结果具有每个测试的输出文件,如下所示:

reportsDirectory/testName-output.txt

reportsDirectory由reportsDirectory配置定义,默认情况下设置为${project.build.directory}/failsafe-reports