Cucumber and Spring integration : overview/documentation anywhere?

122 views
Skip to first unread message

Michael Cunningham

unread,
Jan 14, 2019, 7:07:58 AM1/14/19
to Cukes
I am building a Cucumber/Java project using Spring for dependency injection and am looking for some basic information as to how the Spring container is set up in Cucumber.

I think that new @components are created for each scenario, but is a new Spring container (applicationContext) created, or is one contained created at the start of each Cucumber session?

I have a @Configuration bean in which I use @PropertySource("configuration.properties") to read in the config properties. Is this read in once for the Cucumber session or read in anew for each scenario.

Basically, I'm looking for overview documentation and Spring container lifecycle as it is integrated with Cucumber.

regards,
Michael
Message has been deleted

MP Korstanje

unread,
Jan 15, 2019, 11:04:50 AM1/15/19
to Cukes
Hey Michiael,

there is no documentation. I would appreciate it if some one took the time to write it.

I've learned by looking at/fixing issues with https://github.com/cucumber/cucumber-jvm/blob/master/spring/src/main/java/cucumber/runtime/java/spring/SpringFactory.java

1. Cucumber creates an TestContextManager for each scenario.
2. Step definitions are put into the TestContext as beans at the start of a scenario/example and removed after.
3. TestContextManager uses a thread local (rather then static)  ContextCache and as a result the TestContext is only shared between scenarios executed on the same thread. When executing in parallel this avoids issues caused by #2.

This whole setup is somewhat less then ideal. Which I suspect contributes to it's lack of documentation. I've sketched out a more appropriate implementation here on github: https://github.com/cucumber/cucumber-jvm/issues/1470

Cheers,
Rien

Tim Walker

unread,
Jan 16, 2019, 6:36:21 AM1/16/19
to cu...@googlegroups.com


On Tue, Jan 15, 2019, 10:04 AM MP Korstanje <rien.ko...@gmail.com wrote:
Hey Michiael,

there is no documentation. I would appreciate it if some one took the time to write it

[tim] If that happens I hope it is written in Gherkin and testable in the environment. 


--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages