I created a New Maven project in Eclipse and then created a new "Feature file", "Step Definition" & "Testrunner". However I see quite a few error messages when I hover over the different annotations on the Test Runner class. See below {1 to 5}
I did a lot of research over the internet and added a few dependencies in the pom.xml file but nothing seem to work.
I currently have the following dependencies in my pom.xml file
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.8.2</version>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>6.8.2</version>
<scope>test</scope>
Seems like its got to do something with the jre file. Here are the solutions i have tried based on responses I could find in stackoverflow A] Some solutions over the internet suggested that I add the following dependency to the pom.xml file, but it did not resolve the issue
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.6</version>
<type>pom</type>
<scope>test</scope>
NOTE:- Even after adding these to the pom.xml file i do not see it under Maven Dependencies list.
B] added import cucumber.junit.Cucumber;
but even this did not help
C] Commented out @RunWith(Cucumber, class) and added the following dependency to the pom.xml file
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.5</version>
<type>pom</type>
<scope>test</scope>
NOTE:- The error message against "import cucumber.api.CucumberOptions;" disappeared but error message against "import cucumber.api.junit.Cucumber;" still shows.
Regards, Rohit
I was able to resolve this issue.
Solution:- Verified if the Eclipse Environment was using JUNIT4
Steps:
Clicked on Project--> Properties--> Java Build Path --> Library
Then clicked on Add Library
On the "Select the Library type to add" window selected JUNIT & clicked on Next & then Finish
JUNIT showed up on the Java Build Path window
Clicked on Apply and Close.