如何从java中的.feature文件运行黄瓜测试?

时间:2015-10-22 15:12:51

标签: java selenium intellij-idea cucumber

我目前制作了这个功能文件:

Feature: Open up google chrome and go to news.google.ca

Scenario: Open google news
Then I open google news

这些是我创建此部分的步骤:

import cucumber.api.java.en.Then;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;


public class MyStepdefs {
@Then("^I open google news$")
public void I_open_google_news() throws Throwable {
    WebDriver driver = new ChromeDriver();
    driver.get("http://news.google.ca/");
}
}

然而,当我回到我的功能文件并尝试运行我的场景时: enter image description here 我从IntelliJ收到此错误:

You can implement missing steps with the snippets below:

@Then("^I open google news$")
public void I_open_google_news() throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}







Undefined step: Then  I open google news




1 scenario (0 passed)


1 steps (0 passed)


Process finished with exit code 0

即使我已经完成了我的步骤,我仍然会得到这个错误。我如何修复此问题并从intellij在java中运行我的功能文件 任何人都可以帮助我:(

0 个答案:

没有答案