我试图在Amazon Device Farm上运行Py.Test,我得到了上传应用程序的步骤,选择了一个正常运行的设备池。然而,在尝试上传和运行测试的最后一步,它失败了,我不知道为什么。任何见解都会有所帮助。
我试图投放的回购邮件是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
答案 0 :(得分:0)
我终于明白了。有两件事情在继续,
首先,亚马逊设备农场不喜欢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文件。