I have a testNG suite with more than 10 classes. When I start testNG.xml as a suite, the browsers(ff) not closing before going to 2nd class where I have used to open the browser and close it in every class. I have tested it with giving only one class the browser is closed. Please check the below code for @AfterTest
@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://www.example.com";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test(priority=0)
public void testActivityMasterDBCheck() throws Exception {
--------------------
--------------------
@AfterTest
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString))
{
fail(verificationErrorString);
}
}
and XML is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<classes>
<class name="Admin.ManagePackagesDBCheck"/>
<class name="Reports.ActiveStatusReportDBCheck"/>
----------
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->