如何执行Cucumber Hooks在java中放置在除步骤定义之外的其他类中

时间:2017-06-25 02:34:30

标签: maven cucumber hook cucumber-java

功能文件

功能:演示

场景:我的第一个场景

在谷歌中输入文字

然后点击搜索

步骤定义 公共类LoginSteps {

public WebDriver driver = null;

public LoginSteps() {
    driver = hooks .driver;
}

@When("^enter text in google$")
public void enter_text_in_google() throws Throwable {

    System.out.println("Inside LoginSteps1");

}


@When("^click on search bar$")
public void click_on_search_bar() throws Throwable {
    System.out.println("Inside LoginSteps2");

}

}

public class hooks {

public static WebDriver driver = null;

@Before()
public void inti() {
    System.out
            .println("------------------First Line of the code ---------------");
}

@After()
public void tearDown() {
    System.out.println("---------Closing the Sceanrio");
}

}

0 个答案:

没有答案