我们正在使用QAF进行移动自动化。.bdd文件中有一个步骤,这是常见的,实际上也是许多测试的第一步。
META-DATA: {"author":"<XXX>","description":"SRS-HLP-001-001", "fullReset":true ,groups:[ "EXISTING_USER" , "IOS" , "ANROID" , "REGRESSION_1" , "HELP" ]}
Given User waits for sometime步骤的定义是:
@QAFTestStep(description = "User waits for sometime")
public void stepDefinitionMethodName() throws InterruptedException {
Thread.sleep(5000);
}在执行测试时,我看到测试实际上是经常跳过的,也是随机跳过的。失败的原因是:
无法实例化com.qmetry.qaf.automation.step.StepInvocationException:的
:[]
Eclipse/TestNG报告只显示以下内容。
Appium日志显示:
在文件系统错误上是否确实存在app '/var/folders/_j/9fbrggk96v3b44hlbshdp9tm0000gn/T/2020219-5328-duszjq.92kdd/Payload/.app‘调试:在任何端口信息上,202bc3b5a4c4571e98c08785b278002c7de0f3设备的(/Applications/Appium.app/Contents/Resources/app/node_modules/appium-ios-device/lib/usbmux/index.js:183:13)信息发布连接都拒绝连接到Usbmux.connect 51487错误,在任何端口信息上都没有发现任何缓存连接,调试事件'newSessionStarted’记录在1584634979919 (21:52:59 GMT+0530 (IST)调试遇到内部错误运行命令:GMT+0530: Usbmux.connect Usbmux.connect info <- POST /wd/GMT+0530/session 500 ms - 702拒绝连接到51487调试端口
在下一次测试中,同样的测试可能会通过。
从步骤实现来看,它非常简单,因为它使用thread.sleep等待5秒。我想不出为什么这个测试步骤会抛出上面的错误。
以上步骤来自于下面的场景。我删除了上面的步骤,重新执行了测试。它又一次失败了如下:
#SRS-HLP-001-001
SCENARIO: <description>
META-DATA: {"author":"<XXX>","description":"SRS-HLP-001-001", "fullReset":true ,groups:[ "EXISTING_USER" , "IOS" , "ANROID" , "REGRESSION_1" , "HELP" ]}
Given User accepts Alert box if any
And Verify user is navigated to home screen, else login with "${login.user_name}" and "${login.password}"
And User accepts Alert box if any
Then Verify main Help screen will be displayed Help tab is clicked
END
@QAFTestStep(description = "User accepts Alert box if any")
public void acceptAlerts() throws InterruptedException {
handleBTPermissionAlert();
handlePNSPermissionAlert();
}这就是eclipse中的错误:
无法实例化com.qmetry.qaf.automation.step.StepInvocationException::
:acceptAlerts[]
以下是听众的详细信息:
<test enabled="true" name="Help">
<parameter name="env.resources"
value="resources/data;resources/ios" />
<parameter name="step.provider.pkg"
value="qaf.<xxx>.tests;qaf.<xxx>.steps;qaf.<xxx>.ios.steps" />
<parameter name="appium.capabilities.app"
value="<path to the app>" />
<parameter name="scenario.file.loc" value="scenarios/Help.bdd" />
<classes>
<class>
name="com.qmetry.qaf.automation.step.client.text.BDDTestFactory" />
</classes>
</test>这是使用的ivy.xml。
<ivy-module version="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="com.qmetry" module="QAF" status="integration">
</info>
<dependencies>
<dependency org="com.qmetry" name="qaf" rev="2.1.15" force="true"/>
<dependency org="com.qmetry" name="qaf-support" rev="2.1.13" />
<dependency org="com.qmetry" name="qaf-support-ws" rev="2.1.15" />
<dependency org="org.aspectj" name="aspectjtools" rev="1.9.5"/>
<dependency org="org.aspectj" name="aspectjweaver" rev="1.9.5" />
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3"/>
<dependency org="io.appium" name="java-client" rev="7.3.0"/>
<dependency org="org.seleniumhq.selenium" name="selenium-java" rev="3.141.59" force="true"/>
</dependencies>
</ivy-module>在如何确保测试用例不被频繁跳过方面需要帮助。
发布于 2020-09-14 22:41:35
问题看起来更多与appium有关。如果问题来自步骤stepDefinitionMethodName实现,您可以尝试按以下方式进行更新:
@QAFTestStep(description = "User waits for sometime")
public void stepDefinitionMethodName() {
QAFTestBase.pause(5000);
}
@QAFTestStep(description = "User accepts Alert box if any")
public void acceptAlerts(){
try{
handleBTPermissionAlert();
handlePNSPermissionAlert();
}catch(InterruptedException e){
throw new AutomationError(e);
}
}https://stackoverflow.com/questions/60752877
复制相似问题