I'm trying to create Selenium tests to my Java application, but each test spends about 5 seconds to execute. The most time consuming part of the test is to initialize the Selenium.
I'm initialize the web driver @before
each test and kill the driver @after
test.
Is there any way to start the webdriver and "restart it" every test? Or should I start it and run all tests and then finishes him off? How do I can reduce the time of tests?
I'm using selenium 2, maven and Junit 4.
So I am starting and finishing the tests
@Before
public void setUpBeforeClass() throws Exception {
System.setProperty("webdriver.chrome.driver",
"drivers/chromedriver.exe");
driver = new ChromeDriver();
driver.get(baseUrl);
}
@After
public void tearDownAfterClass() throws Exception {
driver.quit();
}
Thanks advance.