项目作者: U-TOR

项目描述 :
Java project for running mobile tests on iOS and Android with Appium
高级语言: Java
项目地址: git://github.com/U-TOR/java-appium-android-ios-testing.git
创建时间: 2020-04-26T10:32:22Z
项目社区:https://github.com/U-TOR/java-appium-android-ios-testing

开源协议:MIT License

下载


Appium Android and iOS UI testing

This projects is a demo testing framework for validating Android and iOS apps. It uses Cucumber and TestNG for structuring and executing tests. Also, it’s configured with Allure reporting framework.

The key feature of this demo is that it can use device, emulator or cloud provider to run tests. The following cloud providers are supported:

  • BrowserStack
  • Kobiton
  • SauceLabs
  • Perfecto

TODO: AWS Device Farm

See details for configuring providers below

Required Tools

  1. JDK8
  2. Maven

Basic steps for running tests on device or emulator

  1. Update/add profile to profiles node of pom.xml
    1. <profile>
    2. <id>$DEVICE_PROFILE_NAME</id>
    3. <properties>
    4. <provider.name>local</provider.name>
    5. <device.type>device|emulator</device.type>
    6. <device.platform.name>android|ios</device.platform.name>
    7. <device.platform.version>$ANDROID_VERSION</device.platform.version>
    8. <device.name>$DEVICE_NAME</device.name>
    9. </properties>
    10. </profile>
    For iOS device you also need to specify device.udid
  2. Run tests
    1. mvn clean test -P$DEVICE_PROFILE_NAME -P$SUITE_PROFILE_NAME

Generate report

You can generate a report using one of the following command:

  • mvn allure:serve

    Report will be generated into temp folder. Web server with results will start.

  • mvn allure:report

    Report will be generated tо directory: target/site/allure-maven/index.html

Running tests with cloud providers

  1. Signup to cloud device farm service and get your username and access key.
    Set them to $USERNAME, $ACCESS_KEY
  2. Upload your app. Set path or ID, provided by cloud provider to $APP env variable
  3. Create new device provile in pom.xml
    1. <profile>
    2. <id>$PROVIDER-$PLATFORM-$DEVICE_TYPE</id>
    3. <properties>
    4. <provider.name>$PROVIDER</provider.name>
    5. <device.type>$DEVICE_TYPE</device.type>
    6. <device.platform.name>$PLATFORM</device.platform.name>
    7. <device.platform.version>$VERSION</device.platform.version>
    8. <device.name>$DEVICE_NAME</device.name>
    9. </properties>
    10. </profile>
    where
    • $PROVIDER - local, browserstack, saucelabs, kobiton or perfecto
    • $PLATFORM - ios or android
    • $DEVICE_TYPE - device or emulator
    • $VERSION - OS version (i.e “7.0” or “12.4”)
    • $DEVICE_NAME - name of emulator or device
  4. Run tests
    1. USERNAME=... ACCESS_KEY=... APP=... mvn clean test -P$DEVICE_PROVILE -Psuite-full