如何在黄瓜CLI中使用钩子?

时间:2019-06-21 15:30:16

标签: java cucumber command-line-interface hook

我使用的是黄瓜CLI,需要使用钩子@ Before,@ After,@ BeforeClass,@ AfterClass。我在项目的类中声明了这些钩子,但是当我使用CLI运行时,黄瓜将忽略它们。

import org.gradle.api.Project;

public static class Server2 {

    Project project;
    public NamedDomainObjectContainer<Node2> nodes = getProject().container(Node2.class);
    public String url;
    public String name;

    public Server2(String name) {
        this.name = name;
    }

    public void nodes(final Action<? super NamedDomainObjectContainer<Node2>> action) {
        action.execute(nodes);
    }
}

1 个答案:

答案 0 :(得分:1)

挂钩类必须作为胶水添加。尝试

args2 = new String[] { path + "/features", "--glue", "stepFiles", "--glue","<your hook class>",  "--threads", threadsQty, "", "--tags", tags};