【问题标题】:Issue in executing step definition using ExtendedCucumber from com.github.mkolisnyk library使用 com.github.mkolisnyk 库中的 ExtendedCucumber 执行步骤定义时出现问题
【发布时间】:2018-06-04 19:13:27
【问题描述】:

在我添加扩展黄瓜依赖的那一刻,步骤定义没有执行,当我删除扩展黄瓜依赖时它工作正常并执行步骤定义。

下面是我正在使用的 Maven 依赖项。

<dependency>
            <groupId>com.github.mkolisnyk</groupId>
            <artifactId>cucumber-reports</artifactId>
            <version>1.0.5</version>
</dependency>

/*这部分代码不执行Step定义*/

import org.junit.runner.RunWith;

import com.github.mkolisnyk.cucumber.runner.ExtendedCucumber;
import com.github.mkolisnyk.cucumber.runner.ExtendedCucumberOptions;

import cucumber.api.CucumberOptions;

@RunWith(ExtendedCucumber.class)
@ExtendedCucumberOptions(jsonReport = "target/cucumber.json",
        overviewReport = true,
        outputFolder = "target")
@CucumberOptions(features = {"./src/test/resources/features"}, plugin = { "html:target/cucumber-html-report",
        "json:target/cucumber.json", "pretty:target/cucumber-pretty.txt",
        "usage:target/cucumber-usage.json", "junit:target/cucumber-results.xml" },
        glue = { "com/test/stepdefinition" },
        monochrome = true)
public class RunCucumberTest {

}

/* 这工作正常并执行步骤定义*/

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features = { "./src/test/resources/features" }, plugin = { "html:target/cucumber-html-report",
        "json:target/cucumber.json", "pretty:target/cucumber-pretty.txt", "usage:target/cucumber-usage.json",
        "junit:target/cucumber-results.xml" }, glue = {
                "com/test/stepdefinition" }, monochrome = true)
public class RunCucumberTest {

}

我不知道为什么会这样,我在这里遗漏了什么吗?

【问题讨论】:

  • 不执行stepdefs时出现什么错误?
  • 没有看到任何错误,它无法找到步骤定义文件,只是显示成功结果。没有错误。
  • 您可以尝试使用这些设置 - features = {"src/test/resources/features"}glue = {com.test.stepdefinition}。您使用这么旧的版本有什么原因吗?
  • 是的,非常感谢。我也想通了,看到你的评论。那是旧罐子。实际上,我正在重构现有旧项目中的代码并且具有旧依赖项,只是将依赖项更改为 1.0.6。

标签: java cucumber


【解决方案1】:

将所有黄瓜依赖更新到1.2.5,然后它就可以工作了

【讨论】:

    猜你喜欢
    • 2020-11-11
    • 2022-01-26
    • 2020-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多