当前位置: 首页 > 知识库问答 >
问题:

Cucumber testng运行程序失败

麹鸿煊
2023-03-14

下面是我的赛跑课,

package runner;



import cucumber.api.CucumberOptions;
import cucumber.api.testng.AbstractTestNGCucumberTests;

//@RunWith(Cucumber.class)
@CucumberOptions(features="resources/features",glue="step_def")

public class Runner extends AbstractTestNGCucumberTests {
 /* private TestNGCucumberRunner testNGCucumberRunner;

    @org.testng.annotations.BeforeClass(alwaysRun = true)
    public void setUpClass() throws Exception {
        testNGCucumberRunner = new TestNGCucumberRunner(this.getClass());
    }

    @org.testng.annotations.Test(groups = "cucumber", description = "Runs Cucumber Feature", dataProvider = "features")
    public void feature(CucumberFeatureWrapper cucumberFeature) {
        testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature());
    }

    @org.testng.annotations.DataProvider
    public Object[][] features() {
        return testNGCucumberRunner.provideFeatures();
    }

    @org.testng.annotations.AfterClass(alwaysRun = true)
    public void tearDownClass() throws Exception {
        testNGCucumberRunner.finish();
    }*/
}

配置失败:@AfterClass tearDownClass java.lang.NullPoInterException at Cucumber.api.testng.AbstractTestngCucumberTests.tearDownClass(AbstractTestngCucumberTests.java:34)at Sun.Reflect.NativeMethodAccessorImpl.Invoke0(原生方法)at Sun.Reflect.NativeMethodAccessorImpl.Invoke(未知源)at Sun.Reflect.DelegatingMethodAccessorImpl.Invoke(未知源)at1)在org.testng.testrunner.privaterun(testrunner.java:648)在org.testng.testrunner.run(testrunner.java:505)在org.testng.suiterunner.runtest(suiterunner.java:455)在org.testng.suiterunner.runsequency(suiterunner.java:450)在org.testng.suiterunner.privaterun(suiterunner.privaterun(

========================================================================================================默认测试运行测试:1次,失败:0次,跳过:1次

================================================================默认套件运行的测试总数:1,失败:0,跳过:1配置失败:2,跳过:

我不确定我错过了什么。

共有1个答案

甘祺
2023-03-14

功能文件的路径应以源文件夹开头。试一次。它看起来应该是:-

features=“src\\bbd_feature”

 类似资料:
  • pom.xml============== 主类==================== 如果有人看到过类似的问题,请帮忙!

  • 我有一个Micronaut应用程序,可以构建到GraalVM原生映像中。当我从正常的角度运行应用程序时(也就是说,不使用Graal),它运行得非常好。 但是,当我尝试从Graal运行时,在尝试将字符串反序列化到枚举中时,会出现以下运行时异常: 作为参考,我的反序列化程序如下所示: 我想我可能需要为Graal添加一些自定义反射配置,但我不太确定。有人能在这里透露一些信息吗?

  • 该路径引用JRE的副本,我将用runnable.jar将其绑定到安装程序中 运行。bat文件会导致以下错误: 当我使用eclipse将应用程序导出为runnable.jar时,我选择“将所需的库打包到生成的JAR中”

  • 我已经使用向导生成了一个带有导航抽屉的应用程序。 当我选择“运行”“应用”或“调试”“应用”时,我会得到以下错误: 生成签名APK...选项工作,它创建的签名应用程序,可以安装在电话和工作。也可以使或重建项目在调试或发布中工作,没有错误。 null

  • 问题内容: 我看了一些其他的SO问题,没有找到任何解决我问题的方法…我有一个Main.java文件(如下)和一个OthelloLib.jar文件,没有关联的源文件。 运行失败,并 还有更多错误。SimplePlayer和BetterPlayer在jar中定义。我如何告诉Java这个罐子?这个命令:不会引起错误,但是我仍然不知道如何运行程序。如果我运行,java会抱怨: 但是TimeoutExcep