Error while executing cucumber code | Selenium Forum
M
Posted on 12/01/2017
I am getting error while running cucumber code.i added jar files
Cucumber-core 1.2.5,Cucumber-java 1.2.5,Cucumber-html-0.2.3,Cucumber-picocontainer-1.2.5,Cucumber-junit-1.2.5,gherkin-2.12.2
After when i added gherkin jar i am getting this error.please help me out with this.

M
Replied on 12/01/2017

I fix that one but i am not getting output. only i am getting output for @Given annotation and remaining everything was skipped.please
help me out with that issue.


M
Replied on 12/01/2017

I am getting error like this:
@When("^i \"([^\"]*)\" that$")
public void i_that(String arg1) throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}


M
Replied on 12/01/2017

[quote="dugyala.sindhuja@gmail.com":101yctsh]I am getting error like this:
@When("^i \"([^\"]*)\" that$")
public void i_that(String arg1) throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}[/quote:101yctsh]
this error usually comes when feature file and java test file don't match. check that you haven't made any mistake java test file.


M
Replied on 13/01/2017

this is not an error, u need implement that methods in your program. just copy paste it in your script and run it


M
Replied on 13/01/2017

Got it.Thanks


M
Replied on 13/01/2017

Hi Ashish.I am getting below error in Tester.feature file.
cucumber.runtime.CucumberException: Error parsing feature file com/learning/cucucmber/resources/Tester.feature
at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:133)
at cucumber.runtime.model.CucumberFeature.loadFromFeaturePath(CucumberFeature.java:104)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:54)
at cucumber.runtime.model.CucumberFeature.load(CucumberFeature.java:34)
at cucumber.runtime.RuntimeOptions.cucumberFeatures(RuntimeOptions.java:239)
at cucumber.api.junit.Cucumber.<init>(Cucumber.java:62)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: gherkin.parser.ParseError: Parse error at com/learning/cucucmber/resources/Tester.feature:14. Found examples when expecting one of: comment, doc_string, row, scenario, scenario_outline, step, tag. (Current getState: step).
at gherkin.parser.Parser$Machine.event(Parser.java:207)
at gherkin.parser.Parser.event(Parser.java:159)
at gherkin.parser.Parser.examples(Parser.java:124)
at gherkin.lexer.En.scan(En.java:780)
at gherkin.lexer.I18nLexer.scan(I18nLexer.java:36)
at gherkin.parser.Parser.parse(Parser.java:62)
at cucumber.runtime.FeatureBuilder.parse(FeatureBuilder.java:131)
... 22 more

Responsive image

M
Replied on 13/01/2017

and also cucumber.options is not working with my current cucumber jar files so i searched in google and somehow i changed it to
@CucumberOptions(plugin = {"html:target/cucumber-html-report"}).
Is this one is correct or not?can you please explain me in detail.

Thanks.


M
Replied on 13/01/2017

check out our earlier post

http://qtpselenium.com/selenium-tutorial/forum/viewtopic.php?f=20&t=674


M
Replied on 13/01/2017

[quote:23gih17n]@CucumberOptions(plugin = {"html:target/cucumber-html-report"}).
Is this one is correct or not?can you please explain me in detail.
[/quote:23gih17n]

this is correct.


M
Replied on 15/02/2017

@RunWith(Cucumber.class)
@CucumberOptions(format={"html:format"})

public class Runner {

}

try this one , it would work .


M
Replied on 15/02/2017

@RunWith(Cucumber.class)
@CucumberOptions(format={"html:format"})

public class Runner {

}