如何在多个设备上并行运行测试?

重量

无论如何,我无法在多个设备上运行一个测试脚本。

我以一个测试apk和一个测试脚本为例,该脚本从某个站点提取了一个示例,该示例在应用程序中找到一个文本框,然后输入“ Hello World!”。进入脚本,然后完成脚本。我目前正在尝试在两台设备上测试脚本。我创建了四个批处理脚本,其中两个运行带有不同参数的两个appium服务器实例,另外两个运行带有不同参数(包括功能)的两个测试脚本实例。

批处理文件的构建:

运行服务器

start "Appium Server 1" appium -p 5000 -bp 5100 --session-override
start "Appium Server 2" appium -p 5001 -bp 5101 --session-override

(我不知道--session-override应该怎么做,因为在Internet上没有包含对它的详细描述,但是不管有没有它,都会出现相同的结果)。

运行testscript.bat

start "Test 1" node testing.js 5000 9 Emulator-9 emulator-5554
start "Test 2" node testing.js 5001 7 Emulator-7 emulator-5556

(脚本文件后的其他参数为:

<Port> <Android-Version> <Device Name> <Unique ID>

和脚本:

const driver = require("webdriverio");
const args = process.argv;

const caps = {

    port: parseInt(args[2]),
    capabilities: {

        platformName: "Android",
        platformVersion: args[3],
        deviceName: args[4],
        app: "D:/Node/Appium/Test/apk/ApiDemos-debug.apk",
        appPackage: "io.appium.android.apis",
        appActivity: ".view.TextFields",
        automationName: "UiAutomator2", 
        uniqueID: args[5]
    }
};

async function test(caps) {

    const client = await driver.remote(caps);

    const field = await client.$("android.widget.EditText");
    await field.setValue("Hello World!");
    const value = await field.getText();
    assert.equal(value, "Hello World!");

    await client.deleteSession();
}

test(caps);

当我运行两个测试实例时,该应用程序将在两台设备上启动,但是在一台设备上却没有输入“ Hello World!”。另一方面。在没有输入的设备打开的服务器上,还存在“ ECONNRESET:发生服务器端错误等等”。

丹尼亚·齐亚

您需要在Appium配置中添加systemPort使用不同的systemPort每个设备(例如,值82018202等)。

请阅读Appium所需功能

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章