Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java] Deprecate
timout
in favour of library based solutions
## Summary It is possible to provide a timeout to step definitions, however the semantics are unreliable ( #1506). ```java @given(value = "^I have (\\d+) cukes in my belly$", timeout = 5000) public void I_have_cukes_in_my_belly(int cukes) throws Throwable { } ``` Fixes: #1694 ## Current Behavior When the step starts a long running task Cucumber will attempt to interrupt the step once the timeout period is exceeded. If the long running task ignores the interrupt Cucumber will however not stop the test. Depending on the context this behavior is either desired or undesirable. See #1506 for in detail discussion. Additionally the current implementation is complex and has been prone to failures (#1244, #1241, #811, #639, #540). ## Possible Solution While it is possible to implement different strategies to deal with timeouts; there is no perfect solution. And regardless of which solution we pick we would take on a significant amount of complexity. So I believe that for Cucumber there is no good solution. However this problem has been solved by various libraries: * [JUnit 5 `Assertions.assertTimeout*`](https://junit.org/junit5/docs/5.0.1/api/org/junit/jupiter/api/Assertions.html#assertTimeout-java.time.Duration-org.junit.jupiter.api.function.Executable-) * [Awaitility](https://github.com/awaitility/awaitility) * [Guava `TimeLimiter`](https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/TimeLimiter.java) So rather then keeping a poor feature alive we should recommend users to migrate to third party solutions. ## Context & Motivation Remove the eldritch horror that is `Invoker/Timeout.timeout`. While this could have been done in v4.x, v5 will use Java 8 and most of the above libraries require Java 8.
- Loading branch information