No definitions found in cucumber feature file

780 views
Skip to first unread message

MCD dotCom

unread,
May 22, 2020, 8:51:46 PM5/22/20
to Selenium Users
Hello,

I have created a feature file and then I created my step definition. When I run the runner file, it works just fine. I defined Given keyword in the feature file. But I still see warning in the feature file "no definitions found for feature file".

Feature

Feature: my feature
Scenario: Login

Given User is already on login page

Step definition:

package stepDefinition;


import io.cucumber.java.en.And;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
import io.cucumber.java.en.When;
import junit.framework.Assert;


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import static org.junit.Assert.*;
//import org.junit.Assert;
import static org.testng.Assert.assertTrue;


//import cucumber.api.java.en.Given;


public class loginStepDef {
 
 
WebDriver driver;
 
//@Then"^login should be unsuccessful$"


 
@Given ("^User is already on login page$")
 
public void User_already_on_login_page(){
 
System.out.println("givenM is completed successfully.");
 
System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");
        driver
= new ChromeDriver();
        driver
.get("https://web.xxx.com/user");
 
}
 
}

Please see the attached. Thanks!

d1.png
d2.png

Ankit Mundra

unread,
May 23, 2020, 1:10:51 AM5/23/20
to Selenium Users
Hi MCD

I believe you will have a need to tweak the build path of the eclipse project so that it can look for feature files & step definitions correctly.

Regards
Ankit Mundra

MCD dotCom

unread,
May 23, 2020, 12:48:35 PM5/23/20
to Selenium Users
Hi,

Right click the project > configure build page > please see d3 image. 
Click library > apply. Please see d4 image
Updated maven project. Please see d5 image. 

I still have the problem. Again, runner runs just fine. I can also see pretty report. 

Please advise!
d3.png
d4.png
d5.png

MCD dotCom

unread,
May 23, 2020, 12:50:20 PM5/23/20
to Selenium Users
I am also using maven dependency for all the jar files. 

Ankit Mundra

unread,
May 24, 2020, 2:47:01 AM5/24/20
to Selenium Users
Hi MCD

did you check the documentation of the plugin? And did you configure you project for cucumber :: My step definitions are not detected, and my steps from my feature file is highlight in yellow.

Also, if this is not the correct plugin can you provide the plugin name you are using.

Regards
Ankit M.

MCD dotCom

unread,
May 24, 2020, 8:32:55 PM5/24/20
to Selenium Users
Hello, 

In Eclipse, I just installed a new software using this cucumber link http://cucumber.github.com/cucumber-eclipse/update-site.
I successfully installed it. 
After that, I right click the project > convert to cucumber project > but nothing happens. 

Please advise.

Joe Ward

unread,
May 25, 2020, 3:45:05 AM5/25/20
to seleniu...@googlegroups.com
This isn't a support forum for that Eclipse plugin...

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0f8a4a58-6e3c-46cc-ad18-442cbd727fcb%40googlegroups.com.

Villju Joseph

unread,
May 27, 2020, 10:52:53 AM5/27/20
to seleniu...@googlegroups.com
Hi, 

In test runner class, specify path of stepdefenition  file in glue property of cucumberoptions. 

Thanks, 
Villju

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages