-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Cucumber Spring is not finding my step definitions #835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm closing this issue since it sounds more like a question and not a bug report. Please see CONTRIBUTING for details. Feel free to reopen if you can share some code to reproduce, preferably in a GitHub repo. |
It's a bug if my setup matches your example, which to me seems to be the case. If I am wrong, then agree. Sorry! |
Ok we'll see when you supply code to reproduce! |
The code I am using is in the Stack Overflow. Are you saying you need a github? |
@JasonSmiley In your case the problems seems to be that you tried to use class (static) methods as step definitions (as I answered on Stack Overflow) |
I will keep my feed back on stack overflow, but that wasn't the issue - it still can't find my functions |
Just for the record, I checked out your cucumber examples project and couldn't even get it to compile! |
@JasonSmiley That is really strange, because the spring-txn example is building and executing without problems on Travis, here is the latest Travis log, from line 6785 is the output from the spring-txn example. |
well, I checked out the full cucumber-jvm repo, opened spring-txn in intellije via the pom.xml, and then it couldn't compile - I thought it was funny because it didn't know what @CucumberOptions were.... Thanks so much for your support @brasmusson but I am going to give up on cucumber spring. I have already spent 2 days trying to get this to work and I can't waste anymore time on this. |
@JasonSmiley you must open the root pom |
@JasonSmiley I copied the code from your question at stackoverflow and I basically find no problem with it with respect to "finding Step Definitions". I put it in a GitHub project, you can try it yourself if you want (the GitHub project also include the Cucumber-Java-Skeleton project changed to use cucumber-spring). Some notes though:
|
Updated my glue to "com.dibs.inventory.stepDefinitions" to match my step package. Removed @Webapllication annotation from JUnit and cucumber (wasn't required) Added default constructor. Note: The return statement was for a demo I was giving to show that a step function could still be used in a traditional JUnit setting (not all developers I work with are comfortable using cucumber). so just to clarify, cucumber.xml needs a bean line for each step definition? That might explain why I am getting the following error: java.lang.IncompatibleClassChangeError: Found class org.springframework.test.context.TestContext, but interface was expected |
@JasonSmiley You are not using Spring version 4, are you? I get the error:
when using Spring v3.2.13 (I googled up springtestdbunit/spring-test-dbunit#46 when searching for the error message). No, cucumber.xml should not mention the step definition classes. But since Cucumber-spring adds bean definitions for them in the context, they can still |
Ok, I am not sure if I will be able to update my spring version - I am writing a code for a spring project which is currently using 3.2.0.RELEASE so I will find out if there is a reason we haven't upgraded. EDIT: seems that the developers are scared of lose of functionality and tech debt in general for upgrading to 4.1.4+ |
I guess that the options for using Spring v3 and Cucumber-JVM are:
|
Thanks for this @brasmusson, I am going to push for upgrading our spring environment since I will be writing tests for the code, but in the meantime I am just going to be writing CRUD tests and I have been asked to write them in Pure JUnit by the rest of the team. Eventually I will be writing Integration level tests and then cucumber will be much more important so I will make my decision on what cucumber to use then. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Since there is no great documentation on how to use this, I will admit I am possibly setting up my environment incorrectly. However, I can launch the WebApp (I see building of resources in console), I can see cucumber finding my features to execute, but when it tries to actually execute them, it says my steps are not defined and test is ignored.
My code can be found in this stack over flow question http://stackoverflow.com/questions/28466479/cucumber-spring-is-not-finding-step-definitions
To be honest, it looks like a bug in the cucumber to me at the moment, but since there is no good documentation on this, I can't tell if I am doing something wrong. Please advise!
currently using 1.2.2 Cucumber API
The text was updated successfully, but these errors were encountered: