我正在使用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. 如何管理用於端到端測試的測試夾具?
- 2. Java測試管理工具/框架?
- 3. 測試用例管理工具2017
- 4. 測試計劃/文檔/管理工具
- 5. Python中移動測試的AWS設備農場(M2Crypto號)
- 6. iOS在AWS設備場中使用specta進行單元測試
- 7. AWS設備農場 - Appium Python - 測試順序
- 8. 測試android.permission.BIND_DEVICE_ADMIN在設備農場
- 9. 在AWS設備場上運行我的蓋倫測試的問題
- 10. 視頻流測試
- 11. 無法切換到iOS上的WebView上下文Appium測試(AWS設備場)
- 12. MS測試覆蓋工具測試
- 13. ios app dosnt在測試設備上測試時工作
- 14. GUI測試工具
- 15. AD測試工具
- 16. XUL測試工具
- 17. AJAX測試工具
- 18. 測試工具包
- 19. BlackBerry智能手機的移動設備測試 - 獲取測試手機
- 20. 從設備上的用戶測試獲取數據到mac
- 21. 如何務實地測試YouTube的視頻鏈接是好的
- 22. 將Java測試自動化與Microsoft測試管理器,TFS,測試用例鏈接起來
- 23. 我可以有名爲Xray的測試管理工具,而我有名爲Zephyr的較舊的測試管理工具?
- 24. 在物理設備上測試
- 25. CakePHP - 單元測試管理視圖
- 26. 視頻測試工具和自動化的可能性
- 27. 在設備上測試http連接
- 28. 硒 - 如何測試視頻
- 29. VB.NET nUnit TestFixture:測試資源管理器中找不到測試
- 30. Linux設備驅動程序測試的工具或框架?