1

Feature file

Feature: Demo

Scenario: My First Scenario

When enter text in google

And click on Search


Step Definition public class 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");
}

}

Shilpa
  • 75
  • 2
  • 5
  • 12
  • I successfully have used [this solution](https://stackoverflow.com/a/31579738/3250856) to place hooks in a base class – Helgi Jun 25 '17 at 05:15
  • 2
    It does not matter in which class your hooks are as long as it is inside the package structure defined in the 'glue' option. They will be loaded based on the annotation... – Grasshopper Jun 25 '17 at 05:21
  • @Grasshopper: Thanks a lot for solution. The hooks was placed in different package. – Shilpa Jun 26 '17 at 06:01

0 Answers0