【问题标题】:Appium on ADF: Test upload failed using Amazon Device Farm Jenkins pluginADF 上的 Appium:使用 Amazon Device Farm Jenkins 插件测试上传失败
【发布时间】:2016-04-08 23:30:47
【问题描述】:

我正在尝试在 Amazon Device Farm 上运行 Py.Test,我得到了上传应用程序的步骤,选择了一个正常工作的设备池。然而,在它尝试上传和运行测试的最后一步它失败了,我不知道为什么。任何见解都会有所帮助。

我要运行的 repo 是 https://github.com/dlai0001/appium-spike-running-tests-oncloud

这是我的 Jenkins 日志:

Copied 1 artifact from "mock-ios-build" build number 3
[AWSDeviceFarm] Using Project 'appium-poc'
[AWSDeviceFarm] Using DevicePool 'iPhone6 only'
[AWSDeviceFarm] Using App 'staging/TapIt.ipa'
[AWSDeviceFarm] Archiving artifact 'TapIt.ipa'
[AWSDeviceFarm] Uploading TapIt.ipa to S3
[AWSDeviceFarm] Waiting for upload TapIt.ipa to be ready (current status: INITIALIZED)
[AWSDeviceFarm] Upload TapIt.ipa succeeded
[AWSDeviceFarm] Getting test to schedule.
[AWSDeviceFarm] Archiving artifact 'test_examply.py'
[AWSDeviceFarm] Uploading test_examply.py to S3
[AWSDeviceFarm] Waiting for upload test_examply.py to be ready (current status: INITIALIZED)
[AWSDeviceFarm] Upload test_examply.py failed!
Build step 'Run Tests on AWS Device Farm' marked build as failure
Finished: FAILURE

【问题讨论】:

  • 注意,使用 shovel 任务打包 zip 文件并通过 Amazon device farm web console 上传运行测试即可。

标签: amazon-web-services jenkins pytest python-appium aws-device-farm


【解决方案1】:

我终于明白了。发生了两件事,

首先,Amazon Device Farm 不喜欢 Shovel。我不得不从 requirements.txt 中取出铲子。

第二,Jenkins 插件需要一个打包的 zip 文件。因此,创建一个压缩所有依赖项的构建任务(没有铲子)

from shovel import task
import subprocess
import os

@task
def package():
    print("checking tests are collectable")
    result = subprocess.call("py.test --collect-only tests/", shell=True)
    if result != 0:
        print("test collection failed.")
        exit(1)

    print("generating wheelhouse dependencies.")
    result = subprocess.call("pip wheel --wheel-dir wheelhouse -r requirements.txt", shell=True)
    if result != 0:
        print("Generating wheel failed.")
        exit(1)

    print("cleaning unused files.")
    subprocess.call("find . -name '__pycache__' -type d -exec rm -r {} +", shell=True)
    subprocess.call("find . -name '*.pyc' -exec rm -f {} +", shell=True)
    subprocess.call("find . -name '*.pyo' -exec rm -f {} +", shell=True)
    subprocess.call("find . -name '*~' -exec rm -f {} +", shell=True)

    print("zipping test files.")
    result = subprocess.call("zip -r test_bundle.zip tests/ wheelhouse/ requirements.txt", shell=True)
    if result != 0:
        print("Failed to Zip files for Amazon.")
        exit(1)

然后将 Jenkins ADF 任务配置为指向 zip 文件。

【讨论】:

    猜你喜欢
    • 2018-07-05
    • 2015-10-12
    • 1970-01-01
    • 1970-01-01
    • 2017-06-02
    • 1970-01-01
    • 2018-10-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多