assertNotNull(driver) should be relocated to another test
Closed this issue · 0 comments
gigena-git commented
Inside the JUnit module tests, the WebDriverTest::tearDown
method has the following code:
@After
public void tearDown() {
assertNotNull(driver);
driver.quit();
}
Putting assertNotNull(driver);
inside a tearDown method is not efficient. If the purpose of that assertion is to know if the driver is not null, it is better to throw that exception in a separate test method than to throw it in an @After
method.
This patch of code could be refactored to:
@Test
public void assertDriverNotNull(){
assertNotNull(driver);
}
@After
public void tearDown() {
if(driver != null){
driver.quit();
}
}