运行黄瓜功能文件时出现以下错误。无法找出这里的错误。
下面是功能文件:
功能:测试Facebook冒烟情景
场景:使用有效凭据测试登录
给定打开firefox并启动应用程序
时输入有效的用户名和密码
然后用户应该能够成功登录
RUNNER CLASS BELOW:
package com.training.runner;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features="features", glue= {"com.training.teststeps"})
public class testrunner {
}
下面的步骤:
package com.training.teststeps;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class testcasesteps
{
WebDriver driver;
@Given("^Open firefox and start application$")
public void openApplication() {
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.facebook.com");
}
@When("^I enter valid username and password$")
public void enterUserDetails() {
driver.findElement(By.id("email")).sendKeys("hello@gmail.com");
driver.findElement(By.id("pass")).sendKeys("passwordtestpass");
}
@Then("^user should be able to login successfully$")
public void verifyApplication() {
driver.findElement(By.id("loginbutton")).click();
}
}
错误说明:
[31mFailed scenarios:[0m
[31mfeatures/application.feature:2 [0m# Test login with valid credentials
1 Scenarios ([31m1 failed[0m)
3 Steps ([31m3 failed[0m)
0m0.038s
java.lang.AbstractMethodError: cucumber.runtime.java.JavaStepDefinition.matchedArguments(Lgherkin/pickles/PickleStep;)Ljava/util/List;
at cucumber.runtime.RuntimeGlue.stepDefinitionMatches(RuntimeGlue.java:86)
at cucumber.runtime.RuntimeGlue.stepDefinitionMatch(RuntimeGlue.java:71)
at cucumber.runner.Runner.addTestStepsForPickleSteps(Runner.java:111)
at cucumber.runner.Runner.createTestCaseForPickle(Runner.java:99)
at cucumber.runner.Runner.runPickle(Runner.java:79)
at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:117)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:126)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
at ✽.Open firefox and start application(features/application.feature:3)
java.lang.AbstractMethodError: cucumber.runtime.java.JavaStepDefinition.matchedArguments(Lgherkin/pickles/PickleStep;)Ljava/util/List;
at cucumber.runtime.RuntimeGlue.stepDefinitionMatches(RuntimeGlue.java:86)
at cucumber.runtime.RuntimeGlue.stepDefinitionMatch(RuntimeGlue.java:71)
at cucumber.runner.Runner.addTestStepsForPickleSteps(Runner.java:111)
at cucumber.runner.Runner.createTestCaseForPickle(Runner.java:99)
at cucumber.runner.Runner.runPickle(Runner.java:79)
at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:117)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:126)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
at ✽.I enter valid username and password(features/application.feature:4)
java.lang.AbstractMethodError: cucumber.runtime.java.JavaStepDefinition.matchedArguments(Lgherkin/pickles/PickleStep;)Ljava/util/List;
at cucumber.runtime.RuntimeGlue.stepDefinitionMatches(RuntimeGlue.java:86)
at cucumber.runtime.RuntimeGlue.stepDefinitionMatch(RuntimeGlue.java:71)
at cucumber.runner.Runner.addTestStepsForPickleSteps(Runner.java:111)
at cucumber.runner.Runner.createTestCaseForPickle(Runner.java:99)
at cucumber.runner.Runner.runPickle(Runner.java:79)
at cucumber.runtime.junit.PickleRunners$NoStepDescriptions.run(PickleRunners.java:140)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:68)
at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:23)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:73)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:117)
at cucumber.api.junit.Cucumber.runChild(Cucumber.java:55)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at cucumber.api.junit.Cucumber$1.evaluate(Cucumber.java:126)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
at ✽.user should be able to login successfully(features/application.feature:5)