'Michael Cunningham' via Cukes
2018-11-05 16:37:48 UTC
I have a Cucumber/Java project whose glue package is x.y.z
test.resources.features/dropDatabaseFeature.feature which makes use of
methods in the corresponding java steps code dropDatabaseSteps.java
test.resources.features/transferFileFeature.feature which makes use of
methods in the corresponding java steps code transferFileSteps.java
At test.java.x.y.z.databaseSteps/dropDatabaseSteps.java I use
@ContextConfiguration=CucumberConfig.class
At test.java x.y.z.fileSteps/transferFileSteps.java I use
@ContextConfiguration=CucumberConfig.class
and get an error saying both classes attempt to configure the spring
context. If only 1 class has the
@ContextConfiguration=CucumberConfig.class it works ok.
Since I do not want to hide the SpringContext setup in any one feature
file, since I will eventually have many, I created
test.java.x.y.z.SpringContextSetup.java, and empty class which had
@ContextConfiguration=CucumberConfig.class before the class statement.
This resulted in nullPointerException for the injected objects, so the
Spring container config was not being configured. Why is this? It because
there's no features file using the SpringContextSetup class and so the
class is not being loaded at runtime?
test.resources.features/dropDatabaseFeature.feature which makes use of
methods in the corresponding java steps code dropDatabaseSteps.java
test.resources.features/transferFileFeature.feature which makes use of
methods in the corresponding java steps code transferFileSteps.java
At test.java.x.y.z.databaseSteps/dropDatabaseSteps.java I use
@ContextConfiguration=CucumberConfig.class
At test.java x.y.z.fileSteps/transferFileSteps.java I use
@ContextConfiguration=CucumberConfig.class
and get an error saying both classes attempt to configure the spring
context. If only 1 class has the
@ContextConfiguration=CucumberConfig.class it works ok.
Since I do not want to hide the SpringContext setup in any one feature
file, since I will eventually have many, I created
test.java.x.y.z.SpringContextSetup.java, and empty class which had
@ContextConfiguration=CucumberConfig.class before the class statement.
This resulted in nullPointerException for the injected objects, so the
Spring container config was not being configured. Why is this? It because
there's no features file using the SpringContextSetup class and so the
class is not being loaded at runtime?
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.