使用appium为移动自动化设置gitlab cicd吗?

时间:2018-11-06 05:36:04

标签: gitlab appium gitlab-ci appium-ios appium-android

有人使用appium工具为移动自动化设置Gitlab CICD吗?

我想知道如何在gitlab中设置用于自动化的仿真器/设备,以及如何在gitlab中设置appium服务器。

您的意见受到高度赞赏:)

2 个答案:

答案 0 :(得分:0)

我在GitHub上找到了一个存储库,该存储库在Microsoft Azure DevOps CI环境中运行Appium测试。签出仓库here

查看如何设置CI的构建,您应该继续使用Azure DevOps而不是GitLab。

答案 1 :(得分:0)

我找到了有关gitlab-ci和android项目的相关链接:https://about.gitlab.com/2018/10/24/setting-up-gitlab-ci-for-android-projects/

但是,在本示例链接中似乎没有使用appium,但我相信如果您稍加调整,它仍然会很有用。

基本上,这是您需要使用的yml文件:

image: openjdk:8-jdk

variables:
  ANDROID_COMPILE_SDK: "28"
  ANDROID_BUILD_TOOLS: "28.0.2"
  ANDROID_SDK_TOOLS:   "4333796"

before_script:
  - apt-get --quiet update --yes
  - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
  - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
  - unzip -d android-sdk-linux android-sdk.zip
  - echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
  - echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
  - echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
  - export ANDROID_HOME=$PWD/android-sdk-linux
  - export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
  - chmod +x ./gradlew
  # temporarily disable checking for EPIPE error and use yes to accept all licenses
  - set +o pipefail
  - yes | android-sdk-linux/tools/bin/sdkmanager --licenses
  - set -o pipefail

stages:
  - build
  - test

lintDebug:
  stage: build
  script:
    - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint

assembleDebug:
  stage: build
  script:
    - ./gradlew assembleDebug
  artifacts:
    paths:
    - app/build/outputs/

debugTests:
  stage: test
  script:
    - ./gradlew -Pci --console=plain :app:testDebug

我还发现了这个有关StackOverflow的答案,我发现它非常有用:how to set up a Appium UI test maven project to work with Gitlab CI to test Android App?