1

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

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

这是我的詹金斯日志:

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
4

1 回答 1

0

我终于弄明白了。有2件事发生,

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

2nd,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 文件。

詹金斯 ADF 插件

于 2016-04-09T00:37:39.120 回答