Closed reverant closed 2 years ago
I'm assuming you're using JUnit 4 with cucumber-junit
?
Unfortunately using the package of the runner class as the default glue path, ignoring anything else, has been a feature for a long time now. This is something that can not be changed without impacting a large amount of users.
Consider upgrading to JUnit 5 with the cucumber-junit-platform-engine
. It does not have this behaviour.
https://github.com/cucumber/cucumber-jvm/tree/main/cucumber-junit-platform-engine
Ah sorry, I forgot to mention I'm using cucumber-testng version.
Ah, I see.
Then it is mostly the same problem. But if you are running your tests via the XML suite you can define the glue there and it will override the annotation.
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Example Suite">
<parameter name="cucumber.glue" value="com.example.glue"/>
<test name="Vegetable garden" preserve-order="true">
<parameter name="cucumber.features" value="classpath:com/example/features/vegetable"/>
<classes>
<class name="com.example.RunCucumberTests"/>
</classes>
</test>
<test name="Herb garden" preserve-order="true">
<parameter name="cucumber.features" value="classpath:com/example/features/herbs"/><classes>
<class name="com.example.RunCucumberTests"/>
</classes>
</test>
</suite>
👓 What did you see?
When setting cucumber.glue property in cucumber.properties it is always overwritten by a package of class with cucumber options annotation.
✅ What did you expect to see?
If glue is set in cucumber.properties don't overwrite it by default value.
📦 Which tool/library version are you using?
Cucumber 7.4.1 used with java 11.0.13
🔬 How could we reproduce it?
Steps to reproduce the behaviour: