Annotation Type Timeout
Timeouts can be applied to feature methods, fixture methods, and spec classes.
When applied to a feature method, the timeout is per execution of one iteration,
and does not include time spent in fixture methods. When applied to a fixture
method, the timeout is per execution of the fixture method. Applying the timeout
to a spec class has the same effect as applying it to each feature (but not fixture)
method that isn't already annotated with Timeout
.
Timed methods are invoked on the regular test framework thread. This can be important for integration tests that hold thread-local state. When a method times out, it will be interrupted repeatedly until it (hopefully) returns. Methods that continue to ignore interruption may run forever.
When a timeout is reported to the user, the stack trace shown reflects the execution stack of the test framework thread when the timeout was reached.
- Author:
- Peter Niederwieser
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionint
Returns the duration after which the execution of the annotated feature or fixture method times out. -
Optional Element Summary
Optional Elements
-
Element Details
-
value
int valueReturns the duration after which the execution of the annotated feature or fixture method times out.- Returns:
- the duration after which the execution of the annotated feature or fixture method times out
-
unit
TimeUnit unitReturns the duration's time unit.- Returns:
- the duration's time unit
- Default:
SECONDS
-