提问者:小点点

cucumberCLI主跳过特征文件


我想用cucumberCLI代替马文进行cucumber测试。

我的Runner类中有以下代码:

import io.cucumber.core.cli.Main;

public class Runner {

    public static void main(String[] args) {
        Main.main(new String[]{"-g", "src/test/java/com/company/project/stepdefinitions", "-t", "Regression", "src/test/resources/features"});
    }
}

当我执行它时,它不会运行任何测试-

0 Scenarios
0 Steps
0m0.163s

知道我缺少什么吗?如果我删除标签,它会检测到特征文件,但会说缺少相应的步骤定义。

main. main(新增String[]{"-g","src/test/java/com/Company/project/step定义/module1/Stepmodule1","src/test/资源/feature/module1/ValidateModule1.feature"});

Undefined scenarios:
file:///C:/Users/.../src/test/resources/features/module1/ValidateModule1.feature:5 # To Test Module1

1 Scenarios (1 undefined)
1 Steps (1 undefined)
0m0.228s

我调用main函数在CLI与错误的参数?

亲切问候,

阿比


共1个答案

匿名用户

感谢您的建议。

下面的语法为我工作,在独立的Java类中提供胶水和功能文件。

import io.cucumber.core.cli.Main;

public class Runner {

    public static void main(String[] args) {
        Main.main(new String[]{"-g", "com.company.project.stepdefinitions","-t", "@Regression","-p", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:", "src/main/resources/features/"});
    }
}