junit5 icon indicating copy to clipboard operation
junit5 copied to clipboard

Support timeouts for extensions

Open SgtSilvio opened this issue 2 years ago • 0 comments

As https://github.com/junit-team/junit5/issues/2037 was closed as stale and I did not want to ping a random person of the junit team there, I decided to create a new issue. Feel free to close this one and open the old one if you want to proceed the discussion there.

The feature request is to unify the definition of timeouts for extensions with the definition of timeouts in the test classes.

  • Using @Timeout for extension methods (Before/AfterEach/AllCallback)
  • Using global timeouts such as junit.jupiter.execution.timeout.beforeall.method.default applies to extension methods (maybe add a new property like junit.jupiter.execution.timeout.extension.beforeall.default which would make backwards compatibility easier.

While one can workaround with assertTimeoutPreemptively, it would be great if extensions follow the same timeout principles of being able to configure global default timeouts and overwriting them on specific methods if necessary. From the above 2 points the second point is the more important one (the other one would still be great for consistency reasons). Currently it is not possible to avoid stuck CI builds entirely by defining global timeout properties and all extensions need to carefully implement timeouts themselves (which is desired, but global timeouts for safety would be great).

SgtSilvio avatar Jul 11 '22 16:07 SgtSilvio