简体   繁体   English

使用组合属性时,Visual Studio下的NUnit极其慢

[英]NUnit extremely slow under Visual Studio when using combinatorial attribute

My set up is NUnit (latest, 2.6.something), VS13 with R#8 and Win7. 我的设置是NUnit(最新的2.6.something),带有R#8的VS13和Win7。 I noticed to my great surprise that when I'm using the attribute Combinatorial , the IDE gets extremely, painfully slow. 令我惊讶的是,当我使用属性Combinatorial时 ,IDE变得非常缓慢。 We're talking waiting at the greyed out window of VS for a few seconds after each keystroke ! 每次按键后,我们正在等待在VS变灰的窗口中等待几秒钟!

I've googled that but there seems not to be any relevant hits. 我已经用谷歌搜索了,但是似乎没有任何相关的点击。 I suspect our local setup to blame (how one can fail to install NUnit and R#?!) but it could be of interest for others to know what to do when that happens. 我怀疑应该归咎于我们的本地设置(怎么可能无法安装NUnit和R#?

We've noticed that the delay increases exponentially as we increase the number of test cases. 我们注意到,随着我们增加测试用例的数量,延迟成倍增加。 This is an example for one of the methods. 这是其中一种方法的示例。

[Test]
[Combinatorial]
public void AddWaveformTest(
  [Values(null, "", "sec", "stringThatMayBulky")] string s1,
  [Values(null, "", "sec", "stringThatMayBulky")] string s1,
  [Values(null, "", "sec", "stringThatMayBulky")] string s3,
  [Values(null, "", "sec", "stringThatMayBulky")] string s4,
  [Values(int.MinValue, int.MaxValue, -1, 0, 1)] int i1,
  [Values(null, "", "sec", "stringThatMayBulky")] string s5,
  [Values(null, "", "sec", "stringThatMayBulky")] string s6,
  [Values(null, "", "sec", "stringThatMayBulky")] string s7,
  [Values(null, "", "sec", "stringThatMayBulky")] string s8,
  [Values(int.MinValue, int.MaxValue, -1, 0, 1)] int i2)
{
  ...
}

That's a bit above 26 millions operations, which might be a lot but in computer terms it shouldn't be that bad. 这比2600万次操作略高,虽然可能很多,但从计算机的角度来讲应该还不错。 Right? 对? I also noticed that it's not that much the Combinatorial attribute that is the direct cause but Values attribute. 我还注意到,不是直接导致原因的是组合属性,而是属性。 When I comment out the latter, stuff work again, while commenting out the former brings no improvement... 当我注释掉后者时,东西再次起作用,而注释掉前者并没有改善...

You may want to check this thread as it looks like resharper may have a bug in a 8.x version that causes the problem of the editing window taking some time after each keystroke to respond. 您可能需要检查此线程,因为resharper可能在8.x版本中存在一个错误,该错误会导致编辑窗口的问题在每次按键响应后都需要一段时间。

Some areas that were put aside in the comments to the question are: 对问题的评论中忽略了一些领域:

  • setup and teardown being expensive: this idea was tied with the second point -> 设置和拆卸很昂贵:这个想法与第二点联系在一起->
  • some sort of continuous testing exists inside Resharper (sthing like ncrunch capabilities, or approching) but OP doesn't find it likely. Resharper内部存在某种连续测试(例如ncrunch功能或处理),但OP不太可能。

Don't hesitate to come and comment on the problem, I'm very curious about it (btw, does the time during which the editor window is unavailable matches your test duration approximately?) 不要犹豫,就这个问题发表评论,我对此很好奇(顺便说一句,编辑器窗口不可用的时间大约与您的测试时间相符吗?)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM