Skip to main content

TestObject 的 Python API 包装器

项目描述

构建状态 构建状态 编解码器 PyPI 版本

TestObject API 的 Python 库客户端

有关 API 的更多信息,您可以 在此处访问 TestObject 的文档。

入门

安装

要在您的机器上安装,请运行:

pip install testobject

安装后,您可以运行以下内容:

import testobject
client = testobject.TestObject('myusername','my_api_key', password='password')
# Password only needed if using Session Reports
response = client.devices.get_devices()
devices = response.json()
us_devices = devices['US']

运行测试

测试是用 pytest 完成的。要运行这些,只需运行:

pytest

文档

获取所有设备

response = client.devices.get_devices()
devices = response.json()
us_devices = devices['US']

获取可用设备

response = client.devices.get_available_devices()
devices = response.json()
us_devices = devices['US']

获取设备

response = client.devices.get_device('iPhone_5_free')
device = response.json()

获取会话报告

response = client.devices.get_session_reports(last_days=30, offset=1, limit=50)
reports = response.json()

更新 Appium 套件

data = {}
data['title'] = "New Suite Title"
response = client.suites.update_suite(suite_number,data)
content = response.json()

启动 Appium Suite 报告

report = {'className': 'TOTestClass', 'dataCenterId': 'US', 'methodName': 'testMethod', 'deviceId': 'iPhone_5_free'}
data = [report] # If more than one test and/or class add more reports to the data list
response = to.suites.start_suite(suite_number, data)
content = response.json()

停止 Appium 套件报告

response = to.suites.stop_suite(suite_number, suite_report_number)
content = response.json()

停止 Appium Suite 测试

response = to.suites.stop_suite_test(suite_number, suite_report_number, suite_test_number, True)
content = response.json()

跳过 Appium 套件测试

response = to.suites.stop_suite_test(suite_number, suite_report_number, suite_test_number)
content = response.json()

跳过 Appium 测试报告

response = to.watcher.skip_test_report(appium_session_id)

发送 Appium 测试报告

response = to.watcher.report_test_result(appium_session_id,True)

将应用程序上传到项目

response = to.storage.upload_app(upload_app_path, display_name, False)

获取测试报告

response = to.reports.get_test_report(test_report_id)

获取屏幕截图

response = to.reports.get_screenshot(test_report_id, screenshot_id)

获取会议视频

response = to.reports.get_video(video_id)

获取 Appium 日志

response = to.reports.get_appium_log(test_report_id)

获取设备日志

response = to.reports.get_device_log(test_report_id)

获取设备生命体征日志

response = to.reports.get_vitals_log(test_report_id)

获取 XCUITest 日志

response = to.reports.get_xcuitest_log(test_report_id)

作者

执照

该项目在 MIT 许可下获得许可 - 请参阅 LICENSE文件了解详细信息

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

testobject-1.0.0.post1.tar.gz (4.7 kB 查看哈希

已上传 source

内置分布

testobject-1.0.0.post1-py2.py3-none-any.whl (6.8 kB 查看哈希

已上传 py2 py3