Cucumber 黄瓜运行时异常

Cucumber 黄瓜运行时异常,cucumber,Cucumber,这个问题是重复的。我问的原因是我无法从他们那里得到一个有效的答案(或者至少是我能理解的答案) 因此,我再次问 下面是代码。有一个可执行RunnerTest和一个基类 @RunWith(Cucumber.class) @CucumberOptions(plugin = {"html:target/whisper-html-report", "json:target/whisper_report.json", "com.cucumber.listener.ExtentCucumb

这个问题是重复的。我问的原因是我无法从他们那里得到一个有效的答案(或者至少是我能理解的答案) 因此,我再次问

下面是代码。有一个可执行RunnerTest和一个基类

  @RunWith(Cucumber.class)
        @CucumberOptions(plugin = {"html:target/whisper-html-report", "json:target/whisper_report.json", "com.cucumber.listener.ExtentCucumberFormatter:output/report.html"},tags = {"@Tag"})
        public class RunnerTest {
        }

public class BaseClass {
@Before
    public void startUp() {
        try {
            driver = webModel.getUtils().browser();
            driver.get(webModel.getUtils().getProperty("url"));
            driver.manage().window().maximize();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

@After
    public void tearDown(Scenario scenario) throws IOException {
        if (scenario.isFailed()) {
            TakesScreenshot camera = (TakesScreenshot) driver;
            byte[] screenshot = camera.getScreenshotAs(BYTES);
            scenario.embed(screenshot, "image/png");
            System.out.println("screenShot taken");
       }
        driver.close();
        driver.quit();
    }
}


      Feature file
        @Tag
        Feature: will this run
          Scenario: try to execute feature
          Given I feel like running the code
          Then I run the code

        Step definition-

        import cucumber.api.java.en.Given;
        import cucumber.api.java.en.Then;

        public class run_this_MyStepdefs {
            @Given("^I feel like running the code$")
            public void iFeelLikeRunningTheCode()  {
                System.out.println("yes i feel like running the code");
            }

            @Then("^I run the code$")
            public void iRunTheCode()
            {
                System.out.println("hence i am running the code");

            }
        }
下面是错误代码

cucumber.runtime.CucumberException: Failed to instantiate classBaseClass

我试图实例化基类,这就是cucumber异常的原因


从我删除基类对象的那一刻起,一切似乎都很正常。

Raj,你不能简单地发布一条错误消息,期望有人知道你的答案而不看到你的代码。请看更多的guidanceHello伙计们为我的部分问题真诚道歉。我完全理解你的沮丧和愤怒。我已经用适当的代码格式化了我的问题,供您仔细阅读。任何帮助都将不胜感激。我认为这与workspace.xml有关