CircleCI 2.0上是否可以使用Android Espresso的Instrumentation测试?
如果是,请有人帮我配置config.yml文件吗?
我已经尝试了上千次,但没有运气。我可以运行单元测试,但不能运行仪表。

谢谢

最佳答案

这个问题的答案是:是的。 CircleCi可以进行仪器测试。这是我的配置:

version: 2
jobs:
  build:
    working_directory: ~/code
    docker:
        - image: circleci/android:api-25-alpha
    environment:
      JVM_OPTS: -Xmx3200m
    steps:
      - checkout
      - restore_cache:
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
          command: sudo chmod +x ./gradlew
      - run:
          name: Download Dependencies
          command: ./gradlew androidDependencies
      - save_cache:
          paths:
            - ~/.gradle
          key: jars-{{ checksum "build.gradle" }}-{{ checksum  "app/build.gradle" }}
      - run:
          name: Setup emulator
          command: sdkmanager "system-images;android-25;google_apis;armeabi-v7a" && echo "no" | avdmanager create avd -n test -k "system-images;android-25;google_apis;armeabi-v7a"
      - run:
          name: Launch emulator
          command: export LD_LIBRARY_PATH=${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib && emulator64-arm -avd test -noaudio -no-boot-anim -no-window -accel on
          background: true
      - run:
          name: Wait emulator
          command: |
            # wait for it to have booted
            circle-android wait-for-boot
            # unlock the emulator screen
            sleep 30
            adb shell input keyevent 82
      - run:
          name: Run Tests
          command: ./gradlew connectedAndroidTest
      - store_artifacts:
          path: app/build/reports
          destination: reports
      - store_test_results:
          path: app/build/test-results

此配置的唯一问题是由于内存错误不足,因此无法成功构建。如果有人有更好的配置,请分享。

关于circleci - CircleCi 2.0上是否可以使用Android Espresso的Instrumentation测试?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49364745/

10-14 03:18