spock.lang
@Retention(value=RUNTIME) @Target(value={TYPE,METHOD}) public @interface 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.
Modifier and Type | Required Element and Description |
---|---|
int |
value
Returns the duration after which the execution of the annotated feature or fixture
method times out.
|
public abstract int value
public abstract TimeUnit unit