首页 > 解决方案 > io.cucumber.core.exception.CucumberException:java.lang.NoClassDefFoundError:io/cucumber/core/internal/gherkin/ast/Node

问题描述

当我使用 Run as 'JUnit Test' 运行以下代码片段时。我面临以下错误消息 PFA

    import org.junit.runner.RunWith;
    
    import io.cucumber.junit.Cucumber;
    import io.cucumber.junit.CucumberOptions;
    
    @RunWith(Cucumber.class)
    @CucumberOptions(
            features= {"src/test/resources/AppFeatures"},
            glue= {"stepdefinitions", "AppHooks"},
            plugin= {"pretty",
                    "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:",
                    "timeline:test-output-thread/"
                    
            }   //pretty keyword used for printing purpose
            )
    
    
    
    public class MyTestRunner {
    
    }

堆栈跟踪

标签: javaseleniumselenium-webdrivercucumbercucumber-junit

解决方案


你在使用 Beforeclass 和 Afterclass 钩子吗?如果是,请分享它们。

如果没有,请尝试将胶水路径更改为:

glue = "stepdefinitions"

胶水路径应该只指定步骤定义的路径。


推荐阅读