2

I have installed Natural 0.7.6 plug-in from eclipse marketplace and I have Windows 10. Eclipse version: Eclipse IDE for Java Developers Version: 2020-03 (4.15.0) Build id: 20200313-1211

Maven dependencies related to Cucumber:

    <dependency>
    <groupId>io.cucumber</groupId>
    <artifactId>cucumber-java</artifactId>
    <version>5.7.0</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>5.7.0</version>
        <scope>test</scope>
    </dependency>   
  </dependencies>

.feature file

step definition file

  [1]: [https://i.stack.imgur.com/e22x3.png][1]
  [2]: https://i.stack.imgur.com/cAfLY.png

The .feature file complains about "No definition found for ". CTRL+CLICK on .feature file step is not navigating to stepDefinition file (screenshots attached). Am I missing any plugin? Is there any compatibility issues with Eclipse IDE version and the Cucumber plug-in I am using? I appreciate your help guys.

user3166602
  • 31
  • 1
  • 1
  • 3

5 Answers5

5

Steps to make it work.

  1. Clear out all the cucumber related plugins(e.g. Natural 0.9, cucumber eclipse plugin 1.0.0.xxxxx). Please do follow the suggestion of restarting your eclipse.
  2. Go to Help --> Eclipse Market place --> Install 'cucumber-eclipse' plugin. Please do follow the suggestion of restarting your eclipse.
  3. Right click on your project --> Configure --> Convert to Cucumber project.
  4. Now try to navigate to your step definition by 'Ctrl+click' on test step in feature file

Edit: I also changed JRE system library to 1.8( I am not sure it has any influence to make cucumber work )

Rajan Domala
  • 133
  • 1
  • 8
2

I had same problem that CTRL+Click was not working in feature files when I installed Natural plugin in Eclipse IDE. Later, I uninstalled Natural plugin, and installed "Cucumber Eclipse" plugin, and now I can perform ctrl+click on step name of feature file to navigate to the step definition file.

You can follow below stpes:

  1. Un-install Natural plugin

  2. Install Cucumber Eclipse plugin

Note: Below are my Eclipse version details. "Cucumber Eclipse" plugin may not be available for latest Eclipse version

Version: 2019-06 (4.12.0) Build id: 20190614-1200

CMM
  • 543
  • 4
  • 16
  • I tried with the version: Eclipse IDE for Java Developers Version: 2019-06 (4.12.0) Build id: 20190614-1200 – user3166602 May 10 '20 at 18:19
  • I eventually got it thorough and wrote all the steps I followed in github link: https://github.com/cucumber/cucumber-eclipse/issues/204#issuecomment-626411010 Thanks for all your help. – user3166602 May 17 '20 at 20:19
2

With the Cucumber Eclipse plugin, cleaning the Cucumber project (Project > Clean...) made the Gherkin steps Ctrl+click-able again.

egad
  • 21
  • 1
0

You need a cucumber runner file first and inside that you need to glue the step definition file with the cucumber feature. The thing is that in cucumber if you place the feature file, step definition file and runner file in the same package then automatically, it will be able to map the steps from the step definition file with the feature file. But as per the screenshots, I can see that feature and step definition is present in the different packages. Please create a runner file as shown below

>

import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
 features = "<Directory path containing features>" 
 ,glue={"<Step definition package name>"}
 )    //  example: Features: src/test/resources/features, Glue: com.package.name.stepdefs

public class TestRunner {

}

TestRunner.java

user3166602
  • 31
  • 1
  • 1
  • 3
UnknownBeast
  • 979
  • 1
  • 6
  • 13
  • added TestRunner.java with suggestions, still does not work. hyperlink link still not visible. – user3166602 May 09 '20 at 19:18
  • It seems that your features directory is present in src/test/java/features. Could you please change the path as per your features package. Tip: In src/test/java package, only java files must exist. If you have any file with any other extension then you need to keep that in resources folder. If resources source folder is not visible to you then please create source folder with the name as src/test/resources – UnknownBeast May 11 '20 at 04:57
  • Please check the below sample project. I hope that will help you. In order to run the project, just right click on the runner class. go to "Run As" and click on Junit test. https://drive.google.com/open?id=14ehatPyIueyJUNbS1tV2jKbAtSHs_ghX – UnknownBeast May 11 '20 at 05:49
  • Thanks for your comment about feature file path. Modified now. – user3166602 May 13 '20 at 15:15
  • After I corrected my feature file path /src/test/java/features, it worked. Thanks Rapper AB. – user3166602 May 14 '20 at 16:07
  • the issue is resolved. But I hace a comment about your reference project above. Looks like your pom.xml is missing some dependencies for selenium jars. Please refer to the screenshot below for missing jars : – user3166602 May 17 '20 at 20:38
  • Actually the project used selenium/junit and frostyaxe repositories, but no dependencies added for that in pom.xml, so noticing project setup issues. Can you update in github for the latest please? Appreciate your help. – user3166602 May 18 '20 at 14:50
  • Thank you my friend. If you are really interested in the cucumber then I believe that you must look into my repository once. Over there I have created some custom utilities like Cucumber reporting, Talongrid( Automated selenium grid ) and some more and thanks for your above comment I will update that soon. www.github.com/frostyaxe – UnknownBeast May 18 '20 at 15:15
0

If you are not able to get to the relevant step definition method from Feature file by either F3 or CTRL+ Left Mouse Click, change the default editor of Feature file as below image to select correct Cucumber Editor