What happens if I specify --timeout
in nunit console command line, and at a specific test, I specify a smaller MaxTime?
For example, in nunit console my timeout value is 600000 ms ( ie: 600 seconds), but in a test case, my MaxTime
is 20000 ( ie: 20 seconds), what will happen?
My guess is that
Is my understanding correct?
I think you are mixing two different NUnit attribtues:
If a test has a TimeoutAttribute, it will be cancelled when that timeout is exceeded. Cancellation is treated by NUnit as an error, rather than a failure, that is, there is something wrong with the test rather than the system under test. Most folks, however, tend to look at errors and failures as being the same... i.e. the test didn't pass.
The timeout value, which may be specified as an argument to the console runner, should probably have been called "defaultTimeout", since that's what it is. When you specify that argument, all tests without their own TimeoutAttribute are treated as if they had an attribute with that default value. It doesn't matter whether the value is larger or smaller and there is no special treatment of timings between the two values.
NUnit also has a MaxTimeAttribute, which doesn't cancel tests at all. Rather, it simply tracks the length of time used to run the test. If the test would otherwise have passed but exceeded the max time specified, it is marked as a failure.