我正在使用maven在appium java TestNG上运行脚本并在设备farm上运行脚本。设备场以日志形式生成3个o/p ,视频和截图。我的目标是将视频网址变为现实。 This是我的测试管理工具。所以我的问题是如何获得设备场测试视频的视频URL链接?获取AWS设备场测试视频URL链接到我的测试管理工具(Practitest)
-1
A
回答
0
AWS Device Farm有一个名为ListArtifacts的API。 http://docs.aws.amazon.com/devicefarm/latest/APIReference/API_ListArtifacts.html
此API将返回工件列表(文件,屏幕截图和日志)。每个工件都会有一个URL,因此您可以下载该文件。每个工件还包含一个类型,因此您可以遍历工件的列表并找到类型为“VIDEO”的工件。
警告:ListArtifacts请求中的“type”参数与Artifact对象中返回的“type”属性之间存在差异。 ListArtifacts请求中的类型只允许三个值:FILE,LOG,SCREENSHOT。但是,Artifact对象中的type属性有几个可能的值,这些值在此处记录:http://docs.aws.amazon.com/devicefarm/latest/APIReference/API_Artifact.html
0
这是一个简短的python脚本,它可以获取所有视频,在当前工作目录中创建一个目录,然后将所有视频放入该目录。我在使用winders时做了这个,所以你需要改变mac的文件路径。
要使用它首先做拿到项目阿尔恩:
aws devicefarm list-projects --region us-west-2
然后,一旦我们有一个项目阿尔恩打开CMN窗口,cd到该目录此代码是在和类型:
python somefilename.py --project-arn arn:aws:devicefarm:us-west-2:accountNUm:project:11111111-2222-3333-4444-555555555555
它应该开始下载每个视频
import boto3
import json
import requests
import time
import argparse
import sys
import os
import errno
#Device Farm is only available in us-west-2
client = boto3.client('devicefarm',region_name='us-west-2')
# Read in command-line parameters
parser = argparse.ArgumentParser()
#get the project, test, and run types
parser.add_argument("--project-arn", action="store", required=True, dest="projectarn", help="aws devicefarm list-projects --region us-west-2")
args = parser.parse_args()
#list the runs
#https://boto3.readthedocs.io/en/latest/reference/services/devicefarm.html#DeviceFarm.Client.list_runs
runs = client.list_runs(arn=args.projectarn)
for run in runs['runs']:
index = 0
#list the artifacts and get the videos
#https://boto3.readthedocs.io/en/latest/reference/services/devicefarm.html#DeviceFarm.Client.list_artifacts
artifacts = client.list_artifacts(
arn=run['arn'],
type='FILE'
)
#print(json.dumps(artifacts))
for artifact in artifacts['artifacts']:
#get videos
video_url = ''
if artifact['type'] == "VIDEO":
print (str(artifact) + "\n")
video_url = artifact['url']
response = requests.request("GET", video_url)
cwd = os.getcwd()
filename = cwd + "\\videos\\" + "video" + str(index) + ".mp4"
print (filename + "\n")
if not os.path.exists(os.path.dirname(filename)):
try:
print("trying to create directory")
os.makedirs(os.path.dirname(filename))
except OSError as exc: # Guard against race condition
if exc.errno != errno.EEXIST:
raise
with open(filename, "wb") as f:
print("writing response to file")
f.write(response.content)
f.close()
index = index + 1
相关问题
- 1. 测试iPhone移动设备管理(MDM)?
- 2. 如何管理用于端到端测试的测试夹具?
- 3. Java测试管理工具/框架?
- 4. 测试计划/文档/管理工具
- 5. 测试用例管理工具2017
- 6. 无法获取到的raw_input在我的测试现场工作
- 7. Python中移动测试的AWS设备农场(M2Crypto号)
- 8. iOS在AWS设备场中使用specta进行单元测试
- 9. Java Appium测试无法在AWS设备场上运行
- 10. Ionic 2 AWS设备农场Appium测试NG
- 11. AWS设备农场 - Appium Python - 测试顺序
- 12. 测试android.permission.BIND_DEVICE_ADMIN在设备农场
- 13. 在AWS设备场上运行我的盖伦测试的问题
- 14. 视频流测试
- 15. Linux网络设备驱动程序测试的任何测试工具
- 16. 禁用亚马逊设备农场测试中的视频录制
- 17. IPhone设备测试
- 18. 无法切换到iOS上的WebView上下文Appium测试(AWS设备场)
- 19. 管理硒测试
- 20. MS测试覆盖工具测试
- 21. Ruby Selenium测试中的视频捕获?
- 22. ios app dosnt在测试设备上测试时工作
- 23. 我们能否多的测试场景在单个测试用例中TestLink的或任何的测试管理工具
- 24. AD测试工具
- 25. JQuery测试工具
- 26. GUI测试工具
- 27. Javascript测试工具
- 28. XUL测试工具
- 29. AJAX测试工具
- 30. 测试工具包