Error: Failed to create scenario runner while using examples

Multi tool use
Multi tool use


Error: Failed to create scenario runner while using examples



I am using Examples to enter the email but when I run the junit runner file it gives me the error:


" Failed to create scenario runner"



My Junit runner code:


package Runner;

import org.junit.runner.RunWith;


import cucumber.api.junit.Cucumber;
import cucumber.api.junit.Cucumber.Options;

@RunWith(Cucumber.class)
@Options(features="Features",glue={"stepdefinition"})


public class GmailRunner {

}



Here is my feature file:


Feature: Smoke test of Gmail


@GmailSignin
Scenario Outline: Click on Sign in
Given Open chrome
When I go to gmail and click on Sign in
When I enter "<emailid>"
Then I click on next

Examples:
| emailid |
| sarveshsingh.03 |



I am using Cucumber-junit-1.1.2 and junit-4.11



Please help





could you try upgrading your cucumber-junit ?
– Prany
Jul 2 at 3:52





Sir i tried that after reading some solutions with 3.0.2 but it's not working with that as well
– Sarvesh Singh
Jul 2 at 3:53





check your pom.xml and see the dependencies are correct or not
– Prany
Jul 2 at 3:57





Ok sir but i am using java project do I have to add dependency in java project as well???
– Sarvesh Singh
Jul 2 at 3:58





yes, refer this - tutorialspoint.com/cucumber/cucumber_junit_runner.htm
– Prany
Jul 2 at 4:07




2 Answers
2



@Options is deprecated in cucumber-junit-1.1.2 . You should use @CucumberOptions and provide tag names inside it .


@CucumberOptions(features = "relative/path/to/your/featureFile.feature",
tags = "@GmailSignin",
format = { "pretty",
"html:target/site/cucumber-pretty",
"rerun:target/rerun.txt",
"json:target/cucumber1.json" })





It is giving me the same error
– Sarvesh Singh
Jul 2 at 9:14



This is the pom dependencies... If you are using plain java download these versions from maven repository and include them.


<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin-jvm-deps</artifactId>
<version>1.0.4</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>5.0.0</version>
</dependency>

<dependency>
<groupId>io.cucumber</groupId>
<artifactId>tag-expressions</artifactId>
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java8</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>3.0.2</version>
</dependency>
</dependencies>



This is the runner class. CHange the features and glue value to suit your enviroment.


@RunWith(Cucumber.class)
@CucumberOptions(features="src/test/resources/features/gmail.feature",glue={"stepdef"}, dryRun=false)
public class GmailRunner {

}






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

8ZjkOTmTRjy 60tOmH,0dS56f wdZ,ddmR5w pfXDLwuy C2oSCh6zCH1w lG,XgZ N
P1fNPV4cY,0PDlcAXxa0MhhO,aQZR f3em8vDelDTiBJ2YJD090kRdcR sXwDF0,1Pf ARHG

Popular posts from this blog

Rothschild family

Cinema of Italy