如何使用Robot Framework在Android上执行多设备测试

时间:2018-01-09 11:32:42

标签: robotframework

我正在尝试使用带有Appium的Robot Framework在多个移动设备(模拟器)上启动我的应用程序。

我在不同的测试用例中使用了以下关键字。但它仍然只在一个设备上启动应用程序,它首先出现在连接列表中:

 connect( this, SIGNAL( messageReceived( QString ), &lib, SLOT( onMessageReceived( QString ) ) ) );

请使用Robot Framwork-Appium帮助我进行多设备测试

1 个答案:

答案 0 :(得分:1)

问题格式不正确,我正在粘贴示例代码,它将在两台设备上启动应用程序,您可以从这里参考

*** Settings ***
Documentation    This script starts apps on two phones
Library           AppiumLibrary
Library          Collections

*** Variables ***
${APPIUM_SERVER1}    http://0.0.0.0:4723/wd/hub
${APPIUM_SERVER2}    http://0.0.0.0:4750/wd/hub


*** Test cases ***
Test
    setup and open android phone1
    setup and open android phone2

*** Keywords ***
setup and open android phone1
    ${androiddriver1}=    Open Application    ${APPIUM_SERVER1}    platformName=android    platformVersion=7.0    deviceName=f1232233    automationName=uiautomator2
    ...    appPackage=com.samsung.android.contacts    newCommandTimeout=2500    appActivity=com.android.dialer.DialtactsActivity
    Set Suite Variable    ${androiddriver1}

setup and open android phone2
    ${androiddriver2}=    Open Application    ${APPIUM_SERVER2}    platformName=android    platformVersion=7.0    deviceName=s12333   automationName=uiautomator2
    ...    appPackage=com.samsung.android.contacts   newCommandTimeout=2500    appActivity=com.android.dialer.DialtactsActivity    noReset=True
    Set Suite Variable    ${androiddriver2}