Visual Studio NUnit适配器一次只能运行10K测试

时间:2018-10-05 14:45:21

标签: c# unit-testing visual-studio-2017 nunit

我正在将VS 2017与NUnit 3.10一起使用。我有一个具有约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分钟。

Test Count and Duration in Explorer

为什么会这样?有什么我可以配置或改善的方法吗?

更新1:我使用NUnit控制台运行程序运行了相同的测试,并且没有暂停。

NUnit Console Runner

更新2:更有趣的是,我在Visual Studio 2017社区版中运行了测试,但没有看到暂停。我看到暂停的地方仅在Visual Studio 2017 Enterprise版中。

更新3:如果您“全部运行”,则没有间隙。如果您运行特定项目,则会出现差距。

0 个答案:

没有答案
相关问题