0

我正在将 picocontainer 与黄瓜一起使用,我正在尝试将步骤定义与依赖类的包不同,并且我的 stef 定义代码如下所示。但是我得到 NullPointerException 因为 pcontext 没有被初始化。但是,当我在同一个包中移动我的 step def 和 cucumbercontext 类时,它可以工作。

public class stepdef_PracticeTable {

    public CucumberContext context;

    public stepdef_PracticeTable(CucumberContext pcontext)
    {
        this.context = pcontext;
    }

    @Given("user is navigated to {string}")
    public void navigate(String url) throws Exception
    {
        context.driver.get(url);
        PracticeTable.setTryItYourselfBtn(context.driver);
    }
}

在此处输入图像描述

4

0 回答 0