Hello, Friends

    • In this blog I want to explain how to solve the problem of browser session loosing while you run more than one test in a testClass. When I was working on an application, I found that each test create a new browser session. But there is a problem that when I login in my application with a test case and after that when I run next test the browser session have been lost. In this test I have to go through a action which needs login to access it. So I want to store the last browser session where I have login successfully or I didn’t want to create new session for each test. For this I found a easy solution that is makes your test class annotated with following annotation :-@Stepwise
@Stepwise
class GoogleMailSpec extends GebReportingSpec{

    def "go to login page ,login successfully"(){
        //test for login user successfully
    }
    def "go to Inbox link "(){
        //This test is to test a inbox action that needs a user login. Now with the help of @Stepwise annotation  the browser session is saved and our test run successfully.
    }
}
  • Now the geb store browser session for this class.

Hope this helps 🙂