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
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 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). 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. 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. (cherry picked from commit 0ee6620)
- Loading branch information
1 parent
e883987
commit ad78266
Showing
7 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters