Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for @Timeout at class-level for Test Suites #4328

Open
etrandafir93 opened this issue Feb 21, 2025 · 3 comments
Open

Support for @Timeout at class-level for Test Suites #4328

etrandafir93 opened this issue Feb 21, 2025 · 3 comments

Comments

@etrandafir93
Copy link

Deliverables

I want to set different timeouts for different test suites,
for eg: creating FastTest suite with timeout of 1s and IntegrationTest suite with timeouts of 10s

@Suite
@SelectPackages("example")
@IncludeTags("fast")
@Timeout(1) // <-- requested feature
class FastTests {
}

It would be nice to support the @Timeout annotation for suites as well, similar to how it works for test classes (at the class level).

Other class-level annotations like @DisplayName are already supported for test suites.

@mpkorstanje
Copy link
Contributor

mpkorstanje commented Feb 21, 2025

You could set the junit.jupiter.execution.timeout.default property and friends using the @ConfigurationParameter annotation on the suite. It will control the timeout used for tests that do not declare a specific timeout in the @Timeout annotation.

@marcphilipp
Copy link
Member

@etrandafir93 Does @mpkorstanje's suggestion work for you?

@etrandafir93
Copy link
Author

hello @mpkorstanje , @marcphilipp - thanks for the quick reply.

Yes, this technically works and I will use it for my use-case 👍

@Suite
@SelectPackages("example")
@IncludeTags("fast")
@ConfigurationParameter(key = "junit.jupiter.execution.timeout.default", value = "1s")
class FastTests {
}

On the other hand, this is a bit more verbose than the proposed solution and it leaks some knowledge already encapsulated inside @Timeout. I still believe the support for @Timeout would be a good addition to test suites, but I'm happy to work with @ConfigurationParameter otherwise/until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants