数据驱动框架

huangapple 未分类评论45阅读模式
标题翻译

Data driven framework

问题

我在Excel中有10个测试用例,如果我对每个测试用例运行Selenium,应该会上传一个文件并将结果写入同一个Excel。有人知道如何做到这一点吗?
我知道如何读取Excel文件,但是对于每个测试用例上传一个文件,我不知道如何做。

  1. File file = new File(filePath + "\\" + fileName);
  2. //创建FileInputStream类的对象以读取excel文件
  3. FileInputStream inputStream = new FileInputStream(file);
  4. Workbook guru99Workbook = null;
  5. //通过将文件名拆分为子字符串并仅获取扩展名来找到文件扩展名
  6. String fileExtensionName = fileName.substring(fileName.indexOf("."));
英文翻译

I have 10 test cases in Excel, if I run Selenium for each test case, one file should upload and write the result in same Excel. Does anyone know how to do that?
I know how to read Excel file, but for one test case one file upload I don't know how to do that.

  1. File file = new File(filePath+"\\"+fileName);
  2. //Create an object of FileInputStream class to read excel file
  3. FileInputStream inputStream = new FileInputStream(file);
  4. Workbook guru99Workbook = null;
  5. //Find the file extension by splitting file name in substring and getting only extension name
  6. String fileExtensionName = fileName.substring(fileName.indexOf("."));

huangapple
  • 本文由 发表于 2020年3月16日 19:38:49
  • 转载请务必保留本文链接:https://java.coder-hub.com/60705295.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定