[英]I am using TestNg for data driven framework,but data is not fetching from excel
public class FlightVia {
FirefoxDriver driver;
Sheet s;
@Test
public void flight(String From) throws BiffException, IOException {
driver.findElement(By.id("onewayDiv")).click();
//FileInputStream fis=new FileInputStream("C:/Users/Ravi/Desktop/kdf.xls");
Workbook wb= Workbook.getWorkbook(new File("C:/Users/Ravi/Desktop/kdf.xls"));
s=wb.getSheet("Sheet1");
String fromlist=s.getCell(2, 1).getContents();
// WebElement fromdata= driver.findElement(By.name("sourceA"));
Select fromdata=new Select(driver.findElement(By.name("sourceA")));
fromdata.selectByVisibleText(fromlist);
}
@BeforeTest
public void beforeTest() throws InterruptedException {
driver=new FirefoxDriver();
driver.get("http://in.via.com/");
driver.manage().window().maximize();
Thread.sleep(1000);
driver.findElement(By.name("op")).click();
}
@AfterTest
public void afterTest() {
driver.close();
}
}
when i am running this TestNg i am getting "SKIPPED: flight org.testng.TestNGException
: Method flight requires 1 parameters but 0 were supplied in the @Test annotation."当我运行这个 TestNg 时,我得到“跳过:飞行org.testng.TestNGException
:飞行方法需要 1 个参数,但在 @Test 注释中提供了 0。” error错误
in excel sheet i am giving data as From To在 excel 表中,我将数据作为 From To
Mumbai Delhi孟买 德里
Chennai Hyderabad金奈海得拉巴
You need to provide the value for the parameter From
in the flight method.您需要为飞行方法中的参数From
提供值。 You can use any of the method mentioned below:您可以使用下面提到的任何一种方法:
Please check the TestNG document.请查看 TestNG 文档。
Hope it helps!希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.