V3 Documentation

Test Timeouts

As NCrunch is routinely building and running tests against incomplete versions of your source code, it needs to be extremely rigorous with ensuring that tests do not hang the background worker processes and block up the test pipeline.

All components have a configuration option that specifies a default timeout value for all the tests they contain. Unless specifically changed, this will normally be 60 seconds. Where possible, you should reduce this value as much as your tests will allow you to.

NCrunch will observe test runner Timeout attributes, and will extend them to also apply to fixture setup/teardown methods. This means it is possible for you to define a very low default timeout value (i.e. 10 seconds), then set a practice of using the Timeout attributes to specify longer running times for your integration tests. For test frameworks that do not have a built-in timeout attribute (such as MSpec), NCrunch has its own timeout attribute that can be used for this.

While it is possible to disable the default test timeout (by setting it to zero), this is not recommended. Tests that execute with an infinite running time can be kicked off by the engine automatically and will use up valuable space within the test pipeline until they are terminated manually. It is good practice to ensure every test always has a timeout.