1

I currently use NUnit Console to run my NUnit 3 tests. I pass a Timeout command-line option to 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. I assumed that TimeoutAttribute would take precedence over the global Timeout passed to the console runner. 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?

Ken
  • 72
  • 8

1 Answers1

1

Assuming you have properly applied the TimeoutAttribute, it takes precedence over the nunit-console command-line option. The option could more properly be called "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.

Charlie
  • 12,928
  • 1
  • 27
  • 31
  • That doesn't appear to be the behavior that I saw. I pass a timeout of 30 minutes (1800000) using --timeout:1800000 to Nunit Console. In the test code, I apply the Timeout attribute with a value of 2400000, which should have been 40 minutes. However, the test actually timed out in 30 minutes. – Ken Jan 30 '23 at 22:16
  • Well, turns out that I had started my NUnit run job prior to the build completing with the Timeout attribute change. Thus, I ran against old code that didn't have the Timeout set properly. Turns out it works as you indicated. Sorry about that. – Ken Jan 31 '23 at 14:40
  • That happens. I used to like manually running the build and test steps separately, but now I just have Test force a Build to avoid exactly this problem. – Charlie Feb 01 '23 at 01:07
  • I would do that too except I have several jobs that run different test lists against the same build so that I can distribute the load and shorten the test run time. – Ken Feb 01 '23 at 13:52