简体   繁体   English

NUnit TImeoutAttribute 可以覆盖 NUnit 控制台运行器超时吗?

[英]Can NUnit TImeoutAttribute override NUnit Console Runner timeout?

I currently use NUnit Console to run my NUnit 3 tests.我目前使用 NUnit 控制台来运行我的 NUnit 3 测试。 I pass a Timeout command-line option to NUnit Console Runner.我将Timeout命令行选项传递给 NUnit Console Runner。 This timeout is about 30 minutes, but I have one test that takes longer than 30 minutes, so I put a TimeoutAttribute on that one test.这个超时大约是 30 分钟,但我有一个测试需要超过 30 分钟,所以我在那个测试上放了一个TimeoutAttribute I assumed that TimeoutAttribute would take precedence over the global Timeout passed to the console runner.我假设TimeoutAttribute将优先于传递给控制台运行器的全局超时 That does not seem to be the case.事实似乎并非如此。 Seems like the TimeoutAttribute should take precedence or is there some other way I can do this besides changing the Timeout value passed on the command-line?似乎TimeoutAttribute应该优先,或者除了更改命令行上传递的超时值之外,还有其他方法可以做到这一点吗?

Assuming you have properly applied the TimeoutAttribute , it takes precedence over the nunit-console command-line option.假设您已正确应用TimeoutAttribute ,它优先于 nunit-console 命令行选项。 The option could more properly be called "defaultTimeout".该选项可以更恰当地称为“defaultTimeout”。

I'm "assuming" because you haven't included any code that shows where you actually placed the attribute or shown the command-line you are running.我“假设”是因为您没有包含任何代码来显示您实际放置属性的位置或显示您正在运行的命令行。 If you add those to the question, I'll correct this answer as needed.如果您将这些添加到问题中,我会根据需要更正此答案。

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

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