- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.6k
Description
(This issue will describe my problems using JUnit together with another engine: Cucumber. But hopefully the proposed solution would increase JUnit Suite usability overall)
According to the documentation. the preferred way of running Cucumber, is via the JUnit Platform Suite.
I can set configuration parameters for the suite launcher discovery request, which then the underlaying engine can use, via @ConfigurationParameter, or @ConfigurationParameters.
It also defaults to parsing a junit-platform.properties file on classpath if found.
As long as I have set my configuration parameters as described above, the cucumber engine boots nicely, and everything works as expected.
However, when running Cucumber on the CLI, or via my IDE´s "run" functionality, Cucumber is not run via the the JUnit platform.
This makes configuring my tests to work with both JUnit and in standalone mode a bit tricky. Cucumber, in standalone mode, will try and look for a cucumber.properties file on classpath.
So I have a few options:
- Duplicate the junit-platform.propertiesfile, and save it ascucumber.properties.
 (Sad, keeping two files in sync is always a pain)
- Keep my cucumber.propertiesfile, and use annotations for the JUnit Suite (@ConfigurationParameter)
 (Same here, I will have some configuration in-code, and some in a properties file)
- Do neither, and use System properties
 (I dislike it because it requires environmental setup for new developers, and may cause system-system variances)
Instead, it would be super helpful if we could feed configuration parameters to the JUnit Platform Suite, from a properties file of choice. If so I could have a single properties file for both my standalone cucumber runs, and my platform suite runs.
Suggestion
My idea is to introduce a new annotation, like:
@ConfigurationParameterFile("myown.properties")(Naming tbd..)
Which would work just like @ConfigurationParameter, by reading the file and setting the config parameters.
Annotating with both @ConfigurationParameterFile and @ConfigurationParameter should be allowed. Where as @ConfigurationParameter takes precedence for a given key-value.
Deliverables
- New annotation for supplying configuration parameters via properties file.
-  Extend SuiteLauncherDiscoveryRequestBuilderto parse the properties file, as specified in the new annotation
I'd be happy to take a stab at implementing this via a PR.
Feedback always welcome. Hope my points came across clearly, otherwise please let me know!