c# - Visual Studio NUnit 适配器一次只能运行 10K 测试
问题描述
我正在使用带有 NUnit 3.10 的 VS 2017。我有一个具有约 50K 单元测试的解决方案。资源管理器窗口中的注册测试时间为 5-10 分钟(大多数测试不到一毫秒)。但是,在运行时,它实际上需要的时间比这要长得多。每进行 10,000 次测试,就会有一个长时间的停顿(几分钟),似乎什么也没发生。然后下一个 10K 开始,然后是另一个暂停,依此类推。
- 我是并行还是串行运行测试似乎并不重要。10K 组之间的停顿是相同的。
- 我在 NUnit 或 Visual Studio 的文档中找不到关于测试运行的 10K 限制或阈值的任何内容。
- 运行 xUnit 测试(再次大约 50K 测试)而不是 NUnit 的类似解决方案没有这个问题,在 10K 组之间有长时间的停顿
这是测试输出的示例,运行我的测试子集(其中约 26K)
[10/5/2018 10:19:05 AM Informational] ------ Run test started ------
[10/5/2018 10:19:12 AM Informational] NUnit Adapter 3.10.0.21: Test execution started
[10/5/2018 10:19:13 AM Informational] Running selected tests in C:\Users\kspeer\Documents\GitHub\CreatureGen\CreatureGen.Tests.Unit\bin\Debug\CreatureGen.Tests.Unit.dll
[10/5/2018 10:19:27 AM Informational] NUnit3TestExecutor converted 25908 of 25908 NUnit test cases
[10/5/2018 10:26:35 AM Informational] NUnit Adapter 3.10.0.21: Test execution complete
[10/5/2018 10:26:41 AM Informational] NUnit Adapter 3.10.0.21: Test execution started
[10/5/2018 10:26:41 AM Informational] Running selected tests in C:\Users\kspeer\Documents\GitHub\CreatureGen\CreatureGen.Tests.Unit\bin\Debug\CreatureGen.Tests.Unit.dll
[10/5/2018 10:26:56 AM Informational] NUnit3TestExecutor converted 25908 of 25908 NUnit test cases
[10/5/2018 10:34:14 AM Informational] NUnit Adapter 3.10.0.21: Test execution complete
[10/5/2018 10:34:19 AM Informational] NUnit Adapter 3.10.0.21: Test execution started
[10/5/2018 10:34:19 AM Informational] Running selected tests in C:\Users\kspeer\Documents\GitHub\CreatureGen\CreatureGen.Tests.Unit\bin\Debug\CreatureGen.Tests.Unit.dll
[10/5/2018 10:34:33 AM Informational] NUnit3TestExecutor converted 25908 of 25908 NUnit test cases
[10/5/2018 10:38:58 AM Informational] Running selected tests in C:\Users\kspeer\Documents\GitHub\CreatureGen\CreatureGen.Tests.Integration.IoC\bin\Debug\CreatureGen.Tests.Integration.IoC.dll
[10/5/2018 10:38:58 AM Informational] NUnit3TestExecutor converted 26 of 26 NUnit test cases
[10/5/2018 10:38:59 AM Informational] NUnit Adapter 3.10.0.21: Test execution complete
[10/5/2018 10:38:59 AM Informational] ========== Run test finished: 25932 run (0:19:54.0766142) ==========
测试资源管理器中的注册运行时间仅为 37 秒,而日志中为 21 分钟。
为什么会这样?有什么我可以配置或做的事情来改善这一点吗?
更新 1:我使用 NUnit 控制台运行器运行了相同的测试,并且没有暂停。
更新 2:更有趣的是,我在 Visual Studio 2017 社区版中运行了测试,并没有看到暂停。我看到暂停的地方仅在 Visual Studio 2017 企业版中。
更新 3:如果您“全部运行”,则没有差距。如果你运行一个特定的项目,就会出现差距。
解决方案
推荐阅读
- javascript - Discord bot网站,如何获得公会计数
- javascript - 快速设置标头内容响应类型
- gitlab - 按顺序运行 gitlab 作业
- plot - 在(最好)谷歌地图中绘制随时间的运动
- flutter - 当我获得更多时,StreamBuilder 不会更新项目
- kubectl - kubernetes pod 与 localhost 端口通信
- spring - 在用户使用它之前,是否可以在新的 Spring trascation 中执行一些操作?
- node.js - lodash 在嵌套 groupBy 上失败
- binary - 当它们的表示相同时,如何在二进制表示的 8 位内存位置中区分 +128 和 -128?
- android - “react-native run-android”命令不起作用