AbstractTestNGCucumberTests中的空指针异常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AbstractTestNGCucumberTests中的空指针异常相关的知识,希望对你有一定的参考价值。

测试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" })
答案

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

以上是关于AbstractTestNGCucumberTests中的空指针异常的主要内容,如果未能解决你的问题,请参考以下文章