cucumber在从runner类执行测试时使用java-Null指针异常

cucumber在从runner类执行测试时使用java-Null指针异常,java,selenium,selenium-webdriver,cucumber,Java,Selenium,Selenium Webdriver,Cucumber,当从runner类执行场景时,我得到空指针执行选项。当我从功能文件执行测试时,测试执行没有任何错误,我使用标记来运行场景,我在runner类中提到了标记,请告诉我可能的原因 跑步者等级代码: @RunWith(Cucumber.class) @CucumberOptions( features={"Features"} ,glue={"project.stepdef"} ,tags = {"@chrome","@smoke"} , format = {"pretty", "html:targe

当从runner类执行场景时,我得到空指针执行选项。当我从功能文件执行测试时,测试执行没有任何错误,我使用标记来运行场景,我在runner类中提到了标记,请告诉我可能的原因

跑步者等级代码:

@RunWith(Cucumber.class) 
@CucumberOptions( features={"Features"} ,glue={"project.stepdef"} ,tags = {"@chrome","@smoke"} , format = {"pretty", "html:target/site/cucuber-pretty","json:target/site/cucumber.json"} // ,monochrome = true ) 
public class CucumberRunner 
{ 

}

您需要对runner类进行一些小的调整,如下所示:

import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class) 
@CucumberOptions( 
                    features="Features",
                    glue="stepdef",
                    tags = {"@chrome","@smoke"}, 
                    plugin = {"html:target/cucumber-html-report", 
                              "pretty:target/cucumber-pretty.text",
                              "json:target/cucumber.json"},
                ) 
public class CucumberRunner {}

请尝试Hi-soufrk,谢谢,但当我运行功能文件时,我没有得到空指针,我只有在尝试运行Runner类时才得到空指针。您能从Runner类粘贴一些代码吗?@runWithCumber.class@CucumberOptions功能={features},glue={project.stepdef},标记={@chrome,@smoke},格式={pretty,html:target/site/cucuber-pretty,json:target/site/cucumber.json}/,单色=真正的公共类cucucumberrunner{}你能为你的问题添加正确格式的代码吗?从你上面的评论来看,你似乎在注释你的runner中的某些内容?我的runner类就是这样的,但当我在评论中发布时,它显示为正常text@testerautomation我已经做了某些修改,请密切关注,否则只需复制/粘贴并让我知道状态