1

I have a very strange situation, I have created Features and Scenarios in the feature file and corresponding step definitions and methods in the separate class.

I have run tests by running a feature file, and everything was fine, all tests were green.

But, when I run tests from TestRunner class, I got the following message:

Undefined step: Given I am on the Facebook Login page and suggested code.

You can implement missing steps with the snippets below:

@Given("^I am on the Facebook Login page$") public void i_am_on_the_Facebook_Login_page() throws Throwable { // Write code here that turns the phrase above into concrete actions throw new PendingException(); } 

I have noticed that the suggested method have underscore:

(i_am_on_the_Facebook_Login_page()) 

but my methods do not have underscore

(iAmOnTheFacebookLoginPage()) 

Does anybody have an idea why this happens? I can't run tests now even from the feature file.

Recently, I have started using Mac and IntelliJ instead of Windows and Eclipse.

Is it possible that IntelliJ causes the problem? P.S. I have used the option "Create step definition" from IntelliJ

2 Answers 2

0

ah...I figured out what the problem was...I forgot to put this piece of code snippets = SnippetType.CAMELCASE in CucumberOptions.

So, when I put this line of code here

@CucumberOptions( plugin = {"pretty"}, features = {"src/test/resources/features"}, glue = {"/java/stepDefinitions"}, snippets = SnippetType.CAMELCASE)

everything works just fine.

Sign up to request clarification or add additional context in comments.

2 Comments

...but now I have a problem to run tests from feature file, now I got an Undefined step message... when running tests from the feature file. What I'm doing wrong?
Can you show your project structure? More specifically, I'm interested in where the features and step definition folder are located.
0

It is possible your features folder is not in the build path (being a test folder) so Cucumber is unable to find it. Try this.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.