If you use Seleium2 / WebDriver, you can create a launch instance of the browser by calling new FirefoxDriver() , then it can be reused for several tests. For example, if you use JUNIT, you can create a FirefoxDriver driver in @BeforeClass and exit it in @AfterClass .
browserSessionReuse
The SO post below will explain why the session might expire. It may also depend on how you wrote the test case (maybe you initialize it in the setUp() method). Selenium mode in -browserSessionReuse launches a new browser
NOTE. It is always best to isolate tests by creating and closing a browser instance for each test.
source share