I am not able to run cucumber using TestNG runner file | Selenium Forum
B
bahri.vinayak Posted on 29/06/2020

Please help me out here. I am not able to run cucumber using TestNG runner file

Below is the code snippet of MyTestngRunner class

But the system is not giving me the option to run with TestNG

 

I checked my pom.xml for the dependencies and it has TestNG as one of the dependencies. Below are the dependencies I have specified in pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>MyCucumberProject</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>

<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>6.1.1</version>
</dependency>


<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.1.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.assertj/assertj-core -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.16.1</version>
<scope>test</scope>
</dependency>



<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>6.1.1</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>


<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>6.1.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>test</scope>
</dependency>


</dependencies>

</project>


S
Support Team Replied on 01/07/2020

You have done some mistake in runner file

Please check if all annotations are there as per the video


B
bahri.vinayak Replied on 01/07/2020

Na, I copied the same runner file as in the video. 
I figured out, I need to install TestNG in eclipse, having the maven repository doesn't help.   

Thanks anyways. 


S
Support Team Replied on 02/07/2020

yes.. testng should always be included as an eclipse plugin when working with cucumber