Colocar as asserções no bloco try e browser.quit() no finally de forma a deixar o browser fechado se o teste falhar.
@Test void verificarSeLoginEfetuadoComSucesso() { System.setProperty("webdriver.chrome.driver", "drivers/chromedriver"); WebDriver browser = new ChromeDriver(); try { browser.navigate().to("http://localhost:8080/login"); browser.findElement(By.id("username")).sendKeys("fulano"); browser.findElement(By.id("password")).sendKeys("pass"); browser.findElement(By.id("login-form")).submit(); assertNotEquals("http://localhost:8080/login", browser.getCurrentUrl()); assertEquals("fulano", browser.findElement(By.id("usuario-autenticado")).getText()); } finally { browser.quit(); } }