I'm trying to execute @Test outside the throw exception method. The only way I can be able to execute the @Test methods is if I call them within the throws exception method and this makes the @Test methods to fail. Please see my code.
public class Communication extends WebPortalLogin {
public static String driverPath = "C:/";
public static WebDriver driver;
@BeforeTest
public void Circulars() throws Exception {
ExcelUtils.setExcelFile("C://TestData//TestData.xlsx", "Sheet1");
String username = ExcelUtils.getCellData(1, 1);
String password = ExcelUtils.getCellData(1, 2);
driver = WebPortalLogin.login(username, password);
circulars(driver);
option_list(driver);
close_browser();
}
@Test
public void circulars(WebDriver driver) {
WebPortalNGFile.communication(driver).click();
WebPortalNGFile.circulars(driver).click();
}
@Test
public void option_list(WebDriver driver) {
WebPortalNGFile.communication(driver).click();
WebPortalNGFile.option_list(driver).click();
}
@Test
public void close_browser() {
driver.close();
}
}