使用Java / IntelliJ运行黄瓜时出错

时间:2019-03-19 09:55:59

标签: java intellij-idea cucumber

我已经在intelliJ中用Java设置了黄瓜,并且我刚刚将功能文件粘贴到我的步骤文件中并尝试运行它。它并没有真正测试任何东西-它应该通过。但我收到此警告/错误。我正在通过教程学习,并且完全按照步骤进行操作,所以无法理解为什么会发生这种情况?有人可以帮忙吗?错误如下:

    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by cucumber.deps.com.thoughtworks.xstream.core.util.Fields (file:/C:/Users/Kristian.Senior/.m2/repository/io/cucumber/cucumber-jvm-deps/1.0.6/cucumber-jvm-deps-1.0.6.jar) to field java.util.TreeMap.comparator
    WARNING: Please consider reporting this to the maintainers of cucumber.deps.com.thoughtworks.xstream.core.util.Fields
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release

    Skipped step

    Skipped step

    Skipped step

    Skipped step

    1 Scenarios (1 pending)
    4 Steps (3 skipped, 1 pending)
    0m0.393s

    cucumber.api.PendingException: TODO: implement me
        at Steps.LoginFeature.iNavigateToTheLoginPage(LoginFeature.java:18)
        at ✽.I navigate to the login page(C:/Users/Kristian.Senior/CucumberBasics/src/test/java/Features/login.feature:6)

1 个答案:

答案 0 :(得分:0)

您得到例外

cucumber.api.PendingException: TODO: implement me
        at Steps.LoginFeature.iNavigateToTheLoginPage(LoginFeature.java:18)
        at ✽.I navigate to the login page(C:/Users/Kristian.Senior/CucumberBasics/src/test/java/Features/login.feature:6)

强制您执行例外中所述的步骤。

实施步骤如下:

@When("I navigate to the login")
public void i_navigate_to_the_login() {
    System.out.printf("Navigating to login\n");
}

要跳过这些步骤,您可以在strict中设置CucumberOptions

  

严格:如果strict选项设置为false,则在执行时,如果   黄瓜遇到任何未定义/待处理的步骤,那么黄瓜不会   执行失败,未定义的步骤被跳过,BUILD为   成功。