-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Read ConfigurationParameters from properties file in classpath #1003
Comments
Tentatively slated for 5.0 RC3 now, for potential inclusion prior to 5.0 GA. |
What's the expected behavior if there are multiple Do we want a preferred format to specify settings that are package-specific? I can imagine developers wanting to change the default test lifecycle for a package tree for integration tests. Possibly a format similar to a logging properties file? |
in progress |
We will simply implement "first one wins" behavior.
I don't foresee that as likely, and if it did occur that would be a bug in the third-party library. FWIW, I have never heard of any such issues with Spring's |
The goal of this issue is simply to provide a straightforward means for setting configuration parameters on the JUnit Platform using a persistent format: we are not addressing any of the existing configuration parameters supported by JUnit Jupiter in this issue.
If we want to support test instance lifecycle configuration at the package level, I think we should address that as a separate issue and simply look up |
FYI: the code is done and available here: 3e9376b All that's left is documentation. 😉 |
@sbrannen FWIW, it seems to be quite common for logging properties files:
I suggest using |
Alrighty. I'll see if I can make it a bit more robust. Cheers, Sam |
Prior to this commit, configuration parameters could only be set via the LauncherDiscoveryRequestBuilder or JVM system properties; however, neither of these options were robust solutions for repeatable builds with regards to configuration parameters such as JUnit Jupiter's 'junit.jupiter.testinstance.lifecycle.default' that alter the manner in which tests are executed. This commit addresses this issue by introducing support for supplying _configuration parameters_ via a file named 'junit-platform.properties' in the root of the class path. Consult the new 'Configuration Parameters' section of the User Guide for further details. Issue: #1003
Prior to this commit, configuration parameters could only be set via the LauncherDiscoveryRequestBuilder or JVM system properties; however, neither of these options were robust solutions for repeatable builds with regards to configuration parameters such as JUnit Jupiter's 'junit.jupiter.testinstance.lifecycle.default' that alter the manner in which tests are executed. This commit addresses this issue by introducing support for supplying configuration parameters via a file named 'junit-platform.properties' in the root of the class path. Consult the new 'Configuration Parameters' section of the User Guide for further details. Issue: #1003
Resolved in |
Prior to this commit, configuration parameters could only be set via the LauncherDiscoveryRequestBuilder or JVM system properties; however, neither of these options were robust solutions for repeatable builds with regards to configuration parameters such as JUnit Jupiter's 'junit.jupiter.testinstance.lifecycle.default' that alter the manner in which tests are executed. This commit addresses this issue by introducing support for supplying configuration parameters via a file named 'junit-platform.properties' in the root of the class path. Consult the new 'Configuration Parameters' section of the User Guide for further details. Issue: junit-team#1003
Overview
The discussion in #905 has brought to light that some test authors would like to configure different default values for the test instance lifecycle etc. without being forced to annotate each and every test class.
ConfigurationParameters
already allows one to specify parameters for test engines. It currently uses JVM system properties as a fallback mechanism if a requested parameter is not explicitly provided when building a discovery request. However, system properties need to be specified for every launch configuration in an IDE, etc. which is often cumbersome and repetitive.So, in addition to explicit parameters and system properties, we should read configuration parameters from a classpath resource called
junit-platform.properties
that could look like this:Configuration Parameter Resolution
The lookup in
LauncherConfigurationParameters
for a config parameter would check the following sources in this order:So, only if a parameter is neither explicitly specified nor present as a system property, would it be read from the config file.
Deliverables
ConfigurationParameters
from properties file in the classpath.INFO
message if properties file detected.ConfigurationParameters
.The text was updated successfully, but these errors were encountered: