在 Android 设备上执行分布式本机测试 [英] Distributed native test execution over android devices

查看:26
本文介绍了在 Android 设备上执行分布式本机测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在两个 Android 设备上以分布式模式执行测试套件.我正在使用 appium 和 testng.你们中的任何一个都可以这样做吗?

I need to execute a test suite in distributed mode over two android devices . i'm using appium and testng .Any one of you'll able to do so ?

推荐答案

这里有一个很好的设置可以在你的项目中使用:AppiumTestDistribution

Here you have a pretty good setup to use in your project: AppiumTestDistribution

例如,您使用 Maven 构建,然后将依赖项添加到您的项目:

E.g., you build with Maven, then add dependencies to your project:

<dependency>
  <groupId>com.github.saikrishna321</groupId>
  <artifactId>AppiumTestDistribution</artifactId>
<version>09c4398</version>
</dependency>

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

然后你可以像这样运行你的测试:

And then you can run your tests like:

@Test
public void testApp() throws Exception {
    ParallelThread parallelThread = new ParallelThread();
    List<String> tests = new ArrayList<>();
    tests.add("HomePageTest2");
    tests.add("HomePageTest3");
    parallelThread.runner("com.test.site",tests);
}

在您的测试目录下创建 config.properties 文件,该文件应具有以下属性

Create config.properties file under your test directory, which should have below properties

RUNNER=distribute

## For appium 1.6.X users (If appium installed using npm)
APPIUM_JS_PATH=/usr/local/lib/node_modules/appium/build/lib/main.js

## For Windows users 
APPIUM_JS_PATH=C:/Users//AppData/Roaming/npm/node_modules/appium/build/lib/main.js
BROWSER_TYPE=chrome
APP_TYPE=NA
BUNDLE_ID=
FRAMEWORK=testng/cucumber
LISTENERS=listerner2,listerner2 (user can add custom listeners here, comma separated)
MAX_RETRY_COUNT=2 (Provide any retry count on failures, this is applied to all tests globally)

## Default path to capability json is root/caps/, if the location of the android.json & iOS.json is changed make sure you mention as below 
IOS_CAPS=relative/absolute
ANDROID_CAPS=relative/absolute 

## To run test on parallel simulators
DEVICE_PLATFORM=simulator

并从命令行运行测试:

Platform="android/ios/both" mvn clean -Dtest=Runner test

这篇关于在 Android 设备上执行分布式本机测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆