gpt4 book ai didi

java - Maven surefire 插件不在 xml 中包含用于通过测试的系统输出

转载 作者:行者123 更新时间:2023-11-29 09:32:09 25 4
gpt4 key购买 nike

我有一个奇怪的问题 - 我有许多 jUnit 测试生成日志到标准输出,这很好 - 这些测试被打印到控制台等等。但是对于集成部分,我需要将它们包含在 target/surefire-report/TEST-<class>.xml 中.对于失败的测试,有两个 <system-out><system-err>但是对于通过的测试,这两个都丢失了。我已经为此苦苦挣扎了两天,但没有任何运气。似乎没有任何属性(除了 <redirectTestOutputToFile>true</redirectTestOutputToFile> ,它的工作方式有点不同并创建单独的 -output 文件,jenkins 没有选择)可以解决这个问题。

最佳答案

如果您最关心关于 Jenkins 的报告,这是由 Jenkins JUnit plugin 生成的,它有这样一个选项:

Retain long standard output/error: If checked, any standard output or error from a test suite will be retained in the test results after the build completes. (This refers only to additional messages printed to console, not to a failure stack trace). Such output is always kept if the test failed, but by default lengthy output from passing tests is truncated to save space. Check this option if you need to see every log message from even passing tests, but beware that Jenkins's memory consumption can substantially increase as a result, even if you never look at the test results!

参数(用于管道)是keepLongStdio

例如

junit testResults: '**/target/surefire-reports/TEST-*.xml', keepLongStdio: true

关于java - Maven surefire 插件不在 xml 中包含用于通过测试的系统输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26651032/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com