AbstractTestNGCucumberTests中的空指针异常

时间:2017-12-15 15:35:40

标签: selenium-webdriver cucumber testng ui-automation

为测试NG获取错误

错误日志:

    [Error] java.lang.NullPointerException
        at cucumber.api.testng.AbstractTestNGCucumberTests.features(AbstractTestNGCucumberTests.java:29)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:55)
    at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:45

我的测试赛跑者设置:

@CucumberOptions(plugin = { "pretty", "html:target/cucumber", "json:target_json/cucumber.json",
        "junit:taget_junit/cucumber.xml", "com.cucumber.listener.ExtentCucumberFormatter"
        }
features = "C:\\AutomationNeon1\\atom\\src\\main\\features\\smascheduler\\new-schedule.feature", glue = {
                "com.morrisons.automation.stepdefs.sma" })

1 个答案:

答案 0 :(得分:0)

问题是重复步骤定义方法,当我删除重复方法时它得到修复。我忽略了Junit日志,它被打印出来了。