Anyone able to invoke cucumber tests from within a spring boot (1.4.2 and later) app

823 views
Skip to first unread message

cukes_questions

unread,
Feb 15, 2017, 11:17:06 PM2/15/17
to Cukes
Worked perfectly with 1.3.5. But is broken with 1.4 and later versions of spring boot because of the way the spring boot jar is structured.
Feature files and glue classes now sit under BOOT-INF/classes.
Earlier i could reference my feature files as below
classpath:com/mcb/tests
Now the above returns 'No feature files found'.
I then change it to
classpath:BOOT-INF/classes/com/mcb/tests
This works but then the glue classes cannot be found. Cucumber instructs me to implement missing steps.

Any ideas?

Paolo Ambrosio

unread,
Feb 17, 2017, 3:25:50 AM2/17/17
to cu...@googlegroups.com


On 16 Feb 2017 04:17, "cukes_questions" <malcolm...@gmail.com> wrote:
Worked perfectly with 1.3.5. But is broken with 1.4 and later versions of spring boot because of the way the spring boot jar is structured.
Feature files and glue classes now sit under BOOT-INF/classes.

I believe this is because you are putting the step definitions between the main application classes (not tests) and creating an executable jar. It seems to be by design in new Spring Boot versions, probably to stop the bad practice of importing executable jars as dependencies.


This is a nonstandard way of running tests, and I'm not just talking about Cucumber. Have you considered running Cucumber scenarios as tests? (e.g. using the JUnit runner https://github.com/cucumber/cucumber-java-skeleton)


Paolo


Earlier i could reference my feature files as below
classpath:com/mcb/tests
Now the above returns 'No feature files found'.
I then change it to
classpath:BOOT-INF/classes/com/mcb/tests
This works but then the glue classes cannot be found. Cucumber instructs me to implement missing steps.

Any ideas?

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

cukes_questions

unread,
Feb 22, 2017, 1:53:24 PM2/22/17
to Cukes
Thanks for the reply.
I am invoking cucumber.api.cli.Main.run from within my springboot jar to execute the tests. The cucumber options has the classpath to the feature file and the step class, both of which are bundled within the springboot jar.
The springboot jar is not serving as a dependent jar, I am basically invoking my cucumber tests from within it.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.

Sorin

unread,
Mar 6, 2017, 5:40:20 AM3/6/17
to Cukes
Maybe my experience in this example (with code) will answer your questions - I went through it recently and all was smooth:
https://tryingthings.wordpress.com/2016/12/19/cucumber-selenium-spring-boot/
HTH
S

cukes_questions

unread,
Mar 6, 2017, 4:38:15 PM3/6/17
to Cukes
Thanks Sorin. I managed to get mine working by relocating the cucumber feature files and glue classes to another client jar and using properties launcher to launch the spring boot app by specifying loader.path to my client jar.
Reply all
Reply to author
Forward
0 new messages