Description
π What did you see?
When a BeforeAll hook is defined, it is called before any dependencies are injected. This negates a big portion of the usefulness of the hook.
β What did you expect to see?
I expected the injection to be called and completed before any execution hook are invoked. It worked this way in Cucumber 7.0.0. Some change since that version broke this behavior.
π¦ Which tool/library version are you using?
<junit.version>5.10.0</junit.version>
<cucumber.version>7.14.0</cucumber.version>
<junit-platform-suite.version>1.10.0</junit-platform-suite.version>
The behavior was fine before I updated the dependency from:
<junit.version>5.8.2</junit.version>
<cucumber.version>7.0.0</cucumber.version>
<junit-platform-suite.version>1.8.2</junit-platform-suite.version>
EDIT: Using the reproducer code, it seems that the behavior change happened between version 7.1.0 and 7.2.0.
π¬ How could we reproduce it?
https://github.com/BenjaminTanguay/cucumber-injection-hook-bug
Execute the reproducer.sh. It will run the failing code in both the current version and the older failing version.
The relevant elements are:
resources/cucumber.properties
test/java/com/example/RunCucumber.java
test/java/com/example/hook/Hook.java
test/java/com/example/injection/CucumberInjector.java
test/java/com/example/injection/InjectionModule.java