启用“指定批处理大小"时,Azure DevOps版本中缺少控制台输出 [英] Console output missing in Azure DevOps release when enabling "Specify a batch size"

查看:106
本文介绍了启用“指定批处理大小"时,Azure DevOps版本中缺少控制台输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Azure DevOps中运行了一个大型测试集(基于NUnit).最近,我们在Visual Studio测试任务中启用了重新运行失败的测试"选项.最初,由于VSTest中的一个错误,该错误无法处理自定义测试显示名称(测试所需的显示名称),因此无法正常工作.测试仍然只能运行一次.但是,通过设置批量大小,此问题已修复并测试最终正确重试.

We have a large test set running (based on NUnit) within Azure DevOps. Recently we enabled the "Rerun failed tests" option within the Visual Studio Test task. At first, this didn't work due to a bug in VSTest with handling custom test display names (which are required for our tests). Tests would still only run once. However, by setting a batch size, this issue is fixed and tests are finally retried correctly.

除了一个奇怪的效果外,它的工作效果非常好……没有明显的原因,详细的日志不再显示我们自己的自定义输出(由Console.WriteLine生成).以前没有任何问题.我们现在得到的只是默认输出和最终测试结果.

It works wonderful, except for one strange effect... for no apparent reason, the detailed logs are no longer showing our own custom output (generated by Console.WriteLine). This worked without problems before. All we get now is default output and the final test result.

未启用指定批处理大小"的日志提供了更多信息:

Logs without "Specify a batch size" enabled are way more informative:

日志本身仍在写:我们知道每次测试都包含(几乎)所有信息.测试结果中显示了这一点:

The logs themselves are still written: we know that as (almost) all the information is also included per-test. This is shown in the test results:

此外,只需禁用批处理大小选项,即可再次显示日志.

Also, simply disabling the batch size option makes the logs show up again.

是否有人知道导致此行为的原因以及如何解决此问题?到目前为止,在Console.Writeline/Trace.Writeline/Debug.Writeline等之间切换仍然无济于事,而且我还没有找到有关此特定问题的许多其他信息...并且在某些情况下,拥有一个完整的日志该文件是必需的(或者更实用),因此如果我们能够同时进行重试和完整日志记录,那就太好了.

Does anyone have an idea what causes this behavior, and how to fix it? So far, switching around between Console.Writeline/Trace.Writeline/Debug.Writeline etc. hasn't helped, and I haven't found much other info about this specific issue... and there are certain situations where having one complete log file is necessary (or way more practical), so it would be nice if we manage to have both retries and full logging.

提前谢谢!

推荐答案

我发布了

I posted the question on developercommunity.visualstudio.com as well. The discussion took a bit of time, but summarized, the following response was given:

"支持的行为是将测试的跟踪信息作为测试结果文件(trx)/标准控制台日志的一部分而不是构建日志的一部分(如您在问题中提到的那样)显示).请注意,这也取决于所使用的测试框架.没有计划将跟踪信息从测试流到构建日志中.打开批处理"选项时看到的不同行为是由于以下事实:内部执行流会有所变化(最终所有流将在未来几天内收敛到与批处理选项相同的位置).我们建议不要依赖构建日志,而在测试选项卡中,您会在上下文中获得更好的日志,测试用例/测试运行."

完整的测试运行输出应该在测试运行中找到的trx文件中可用.经检查,确实是这样:

A full test run output should be available in the trx files found in the test run. Upon check, this is indeed the case:

在Notepad ++中打开文件时,我终于看到了完整运行的日志:

When opening the file in Notepad++, I finally see the logs of my complete run:

-所有这些行都是使用Console.WriteLine()编写的.

-如果trx文件多于一个,则最大的文件保存完整运行的日志:小的文件仅包含所选测​​试的日志.

注意: 我们发现在测试运行超时期间,不会生成此文件.这已报告给Microsoft,并被确认为问题:

NOTE: We found that during a test run timeout, this file is not generated. This has been reported to Microsoft and is acknowledged as an issue:

"明白了这一点.我们正在研究vstest任务中的高级诊断.例如,如果测试需要花费更多的时间来完成,我们将中止测试.在这种情况下,将转储测试过程第二种情况,不是垂直测试花费时间,而是整体运行超时,我们将转储测试过程并中止运行,转储将帮助您调试问题."

将来某个地方应该可以使用此转储.

Somewhere in the future, this dump should be available to use.

这篇关于启用“指定批处理大小"时,Azure DevOps版本中缺少控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆