注意:仅支持最新版本
1. Create a xls file under scenario
2.In the config file use the ExcelTestFactory class
3.Execute
应该可以成功执行
jxl.read.biff.BiffException:无法识别 OLE 流
在 jxl.read.biff.CompoundFile.(CompoundFile.java:116)
在 jxl.read.biff.File.(File.java:127)
在 jxl.Workbook.getWorkbook(Workbook.java:221)
在 jxl.Workbook.getWorkbook(Workbook.java:198)
在 com.qmetry.qaf.automation.step.client.excel.ExcelScenarioFileParser.parseFile(ExcelScenarioFileParser.java:46)
在 com.qmetry.qaf.automation.step.client.excel.ExcelScenarioFileParser.parse(ExcelScenarioFileParser.java:60)
在 com.qmetry.qaf.automation.step.client.ScenarioFactory.process(ScenarioFactory.java:110)
在 com.qmetry.qaf.automation.step.client.ScenarioFactory.getTestsFromFile(ScenarioFactory.java:82)
在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
在 sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)
在 sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)
在 java.lang.reflect.Method.invoke(Unknown Source)
在 org.testng.internal.FactoryMethod.invoke(FactoryMethod.java:90)
在 org.testng.internal.TestNGClassFinder.(TestNGClassFinder.java:150)
在 org.testng.TestRunner.initMethods(TestRunner.java:451)
在 org.testng.TestRunner.init(TestRunner.java:270)
在 org.testng.TestRunner.init(TestRunner.java:240)
在 org.testng.TestRunner.(TestRunner.java:192)
在 org.testng.remote.support.RemoteTestNG6_9_10$1.newTestRunner(RemoteTestNG6_9_10.java:29)
在 org.testng.remote.support.RemoteTestNG6_9_10$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_9_10.java:65)
在 org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:594)
在 org.testng.SuiteRunner.init(SuiteRunner.java:168)
在 org.testng.SuiteRunner.(SuiteRunner.java:117)
在 org.testng.TestNG.createSuiteRunner(TestNG.java:1319)
在 org.testng.TestNG.createSuiteRunners(TestNG.java:1306)
在 org.testng.TestNG.runSuitesLocally(TestNG.java:1160)
在 org.testng.TestNG.run(TestNG.java:1064)
在 org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
在 org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
在 org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
配置文件:
</classes>
您能否更新配置文件代码并提供您正在使用的excel文件?
配置文件:
<test name="Test" enabled="true">
<parameter name="scenario.file.loc" value="./scenarios/Platform_Automation/test.xls"></parameter>
<classes>
<class name="com.qmetry.qaf.automation.step.client.excel.ExcelTestFactory" />
</classes>
</test>
Excel表格:
我无法附上excel表。 但下面是excel表格的内容,表格名称是test.xls。
场景:批处理器 | | | | | |
-- | -- | -- | -- | -- | -- | ——
元数据:{“描述”:“验证”,“组”:[烟雾”,“回归”],“作者”:“阿伦”}
| | | | | | | | |
| 鉴于在 'virtual.machine' 上运行 '${unix.command.ondot-status}' | |
| 然后是主动验证的 ondot-status | | | | |
完 | | | | | | | | |
您为 excel 定义的格式是错误的格式。
下面是工作测试和excel文件。
<test name="Test" enabled="true">
<parameter name="scenario.file.loc" value="./scenarios/test.xls"></parameter>
<classes>
<class name="com.qmetry.qaf.automation.step.client.excel.ExcelTestFactory" />
</classes>
</test>
情景 | 搜索产品 | {"description":"验证用户是否能够使用搜索文本框搜索产品","groups":["SMOKE"]}
-- | -- | ——
启动应用程序| |
搜索产品 | [“衬衫”] |
完 | |
这里第一列应该是步骤名称(不是描述),第二列是参数列表。
步骤实现是
@QAFTestStep(description = "I search for product {0}")
public void searchForProduct(String product) {
//to-do
}
我更改了 excel 格式,但仍然出现相同的错误。 我们有这方面的示例项目吗?
场景 | 测试 | {"description":"验证用户是否能够使用搜索文本框搜索产品","groups":["SMOKE"]}
-- | -- | ——
运行 | [“你好”] |
完 | |
另外,如果我想传递多个输入,我该怎么办:)
提前致谢 :)
看起来您的 excel 格式不正确。
谢谢阿米特 :) 那是正确的。 我正在使用损坏的文件 :) 非常感谢。
此外,我在 excel 文件中使用一个输入,我的方法采用一个参数。 但是我在工作表中给出的输入没有通过。
您能否分享您共享的上述excel表的步骤定义? :)
我在上面的评论中更新了步骤实现。 你可以参考一下。
谢谢:)它有效:)我实际上将bdd场景复制粘贴到excel表中:)它从xml和属性文件中读取数据:)
快乐 :) 感谢阿米特的帮助 :)
嗨,阿米特,
我有这个场景。 我需要将 JSONArray 或 JsonObject 作为输入传递。 我正在使用 ExcelTestFactory。
以下是我的示例输入:
["节点名",["a","b","c"]]
我希望全世界都被阅读。 QAF 无法整体阅读所有内容,因为我有逗号。
你能告诉我如何解决这个问题吗:)
非常感谢您的帮助。
此外,我无法将这些值存储在外部文件中,因为输入来自外部团队。
最亲切的问候,
CK