首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >黄瓜运行时异常

黄瓜运行时异常
EN

Stack Overflow用户
提问于 2018-04-29 20:19:00
回答 1查看 248关注 0票数 0

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

下面的code.there是一个可执行的RunnerTest和一个baseClass

代码语言:javascript
复制
  @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");

            }
        }

下面是错误代码

代码语言:javascript
复制
cucumber.runtime.CucumberException: Failed to instantiate classBaseClass
EN

回答 1

Stack Overflow用户

发布于 2018-06-08 22:46:45

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

在我移除基类对象的那一刻,一切似乎都运行得很好。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50086483

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档