user1767083
user1767083

Reputation: 157

How to stop closing and opening of browser in each cucumber scenario execution

I have written few scenarios in one cucumber feature file and its execute with Selenium web driver.

Cucumber feature

Scenario 1 Scenario 2 Scenario 3

When ever I execute the tests it openup new browser session and close it at the end. I would like to run the 3 tests in same browser session.

How can i achieve this?

Upvotes: 1

Views: 5969

Answers (1)

Zach
Zach

Reputation: 1006

Using the JUnit Annotations below in your Test Runner not Test Hook.

      @BeforeClass
      public static void setUp(){

      openABrowser();
     }

      @AfterClass
      public static void tearDown(){

      closeABrowser();

}

Upvotes: 2

Related Questions