I am trying to figure out if something is possible (or if I am being a bit silly.)
I have a very simple Excel sheet - 2 columns, one column is a list of search terms, the second column is a list of expected URLS. I run this via selenium, it will navigate to google, open the Excel sheet, search for the term and if the expected result appears pass the test. It does this for the three rows in the sheet. All good. However, I was hoping to @Test each of the rows - but I can't quite figure out how to achieve this.
Below is the test code, like I said I can't quite get this to work - at present it runs but appears as a single test which has had 3 different searches.
@Test
@Severity(SeverityLevel.CRITICAL)
public void driveDatData() throws InterruptedException, BiffException, IOException {
parameters = WebDriverSteps.currentDriver.toString();
steps.openWebPage("http://www.google.co.uk");
FileInputStream fi = new FileInputStream("C:\\temp\\sites.xls");
Workbook w = Workbook.getWorkbook(fi);
Sheet s = w.getSheet("Sheet1");
for (int i=1;i<=s.getRows(); i++)
{
if (i > 1)
{
steps.goToURL("http://www.google.co.uk");
}
steps.search(s.getCell("A" + i).getContents());
Assert.assertTrue("Check the " + s.getCell("A" + i).getContents() + " link is present", steps.checkForTextPresent(s.getCell("B" + i).getContents()));
}
}