在surefire中检索成功测试的标准输出?

Hyn*_*nek 6 surefire maven

Maven Surefire为每个失败的测试记录标准输出和错误输出,稍后可以在surefire-reports目录中生成的文件中找到这些输出。然而,没有错误通过的测试的输出被丢弃。是否可以设置surefire来记录成功通过的测试的stdout/stderr?

ser*_*g10 6

是的。您可以使用此可选参数将测试的输出重定向到文件:

重定向测试输出到文件

它默认为 false。如果你打开它:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <configuration>
    <redirectTestOutputToFile>true</redirectTestOutputToFile>
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

您的单元测试输出将被写入 reportsDirectory/testName-output.txt