提交 9e4653ac authored 作者: 陈泽健's avatar 陈泽健

补充app_base中app_get_by_enum、input_text_with_retry、click_element_with_retry、get_...

补充app_base中app_get_by_enum、input_text_with_retry、click_element_with_retry、get_text_with_retry函数用以自动化测试调用。增加门口屏首次安装部署的自动化测试流程及JSON数据。
上级 a74e1bdc
...@@ -908,3 +908,128 @@ def click_with_retry(element, max_retries=3, retry_delay=5): ...@@ -908,3 +908,128 @@ def click_with_retry(element, max_retries=3, retry_delay=5):
sleep(retry_delay) sleep(retry_delay)
# 如果所有重试都失败,抛出异常 # 如果所有重试都失败,抛出异常
raise Exception(f"多次尝试点击元素失败: {element}") raise Exception(f"多次尝试点击元素失败: {element}")
# 枚举类型转换函数
def app_get_by_enum(type_str):
"""
将字符串类型的定位器类型转换为 selenium.webdriver.common.AppiumBy.By 枚举类型。
参数:
type_str (str): 定位器类型字符串,例如 'XPATH'。
返回:
selenium.webdriver.common.by.By: 对应的 By 枚举类型。
"""
# 将输入的定位器类型字符串转换为大写,以匹配 By 枚举类型的命名
type_str = type_str.upper()
# 根据输入的字符串类型返回对应的 By 枚举类型
if type_str == 'XPATH':
return AppiumBy.XPATH
elif type_str == 'ID':
return AppiumBy.ID
else:
# 如果输入的定位器类型字符串不匹配任何已知的 By 枚举类型,抛出 ValueError 异常
raise ValueError(f"未知的定位器类型: {type_str}")
# app输入框事件函数
def input_text_with_retry(app_driver, by, value, text, max_retries=3, retry_delay=5):
"""
使用重试机制在指定的输入框中输入文本。
在WebDriver(app_driver)中通过给定的查找方式(by)和值(value)来查找页面上的输入框。
如果在指定的最大重试次数(max_retries)内仍然找不到元素,则抛出异常。
每次重试之间会有指定的延迟时间(retry_delay)。
参数:
- app_driver: WebDriver实例,用于执行查找和输入操作。
- by: 查找元素的方式,如XPath、ID等。
- value: 元素的值,根据'by'参数指定的查找方式对应的具体值。
- text: 要输入到输入框中的文本。
- max_retries: 最大重试次数,默认为3次。
- retry_delay: 每次重试之间的延迟时间,默认为5秒。
异常:
- 如果超过最大重试次数仍未找到元素,则抛出异常。
"""
for _ in range(max_retries):
try:
# 尝试查找输入框并输入文本
element = app_driver.find_element(by, value)
element.send_keys(text)
return # 成功输入后退出函数
except Exception as e:
# 如果操作失败,记录日志并等待一段时间后重试
logging.warning(f"输入文本失败,重试中... ({e})")
sleep(retry_delay)
# 如果达到最大重试次数仍未成功,则抛出异常
raise Exception(f"多次尝试输入文本失败: {by}={value}")
# app点击事件函数
def click_element_with_retry(app_driver, by, value, max_retries=3, retry_delay=5):
"""
使用重试机制点击指定的元素。
在WebDriver(app_driver)中通过给定的查找方式(by)和值(value)来查找页面上的可点击元素。
如果在指定的最大重试次数(max_retries)内仍然找不到元素或点击失败,则抛出异常。
每次重试之间会有指定的延迟时间(retry_delay)。
参数:
- app_driver: WebDriver实例,用于执行查找和点击操作。
- by: 查找元素的方式,如XPath、ID等。
- value: 元素的值,根据'by'参数指定的查找方式对应的具体值。
- max_retries: 最大重试次数,默认为3次。
- retry_delay: 每次重试之间的延迟时间,默认为5秒。
异常:
- 如果超过最大重试次数仍未成功点击元素,则抛出异常。
"""
for _ in range(max_retries):
try:
# 尝试查找元素并点击
element = app_driver.find_element(by, value)
element.click()
return # 成功点击后退出函数
except Exception as e:
# 如果点击失败,记录日志并等待一段时间后重试
logging.warning(f"点击元素失败,重试中... ({e})")
sleep(retry_delay)
# 如果达到最大重试次数仍未成功,则抛出异常
raise Exception(f"多次尝试点击元素失败: {by}={value}")
# app获取文本事件函数
def get_text_with_retry(app_driver, by, value, max_retries=3, retry_delay=5):
"""
使用重试机制从指定元素中获取文本内容。
在WebDriver(app_driver)中通过给定的查找方式(by)和值(value)来查找页面上的元素,
并尝试从中提取文本内容。如果在指定的最大重试次数(max_retries)内仍然找不到元素或获取失败,
则抛出异常。每次重试之间会有指定的延迟时间(retry_delay)。
参数:
- app_driver: WebDriver实例,用于执行查找和获取操作。
- by: 查找元素的方式,如XPath、ID等。
- value: 元素的值,根据'by'参数指定的查找方式对应的具体值。
- max_retries: 最大重试次数,默认为3次。
- retry_delay: 每次重试之间的延迟时间,默认为5秒。
返回:
- 成功获取到的元素文本内容。
异常:
- 如果超过最大重试次数仍未成功获取文本,则抛出异常。
"""
for _ in range(max_retries):
try:
# 尝试查找元素并获取文本
element = app_driver.find_element(by, value)
text = element.text
if text: # 确保文本非空
return text
logging.warning("获取到空文本,重试中...")
sleep(retry_delay)
except Exception as e:
logging.warning(f"获取文本失败,重试中... ({e})")
sleep(retry_delay)
# 如果达到最大重试次数仍未成功,则抛出异常
raise Exception(f"多次尝试获取元素文本失败: {by}={value}")
\ No newline at end of file
1. 2025-04-14 1. 2025-04-14
- 补充预定配套件的项目目录,并补充公用方法类,以及调试门口屏的功能。 - 补充预定配套件的项目目录,并补充公用方法类,以及调试门口屏的功能。
2. 2025-05-06
- 补充app_base中app_get_by_enum、input_text_with_retry、click_element_with_retry、get_text_with_retry函数用以自动化测试调用。
- 增加门口屏首次安装部署的自动化测试流程及JSON数据。
\ No newline at end of file
import sys import sys
import os import os
from venv import logger from time import sleep
# 获取当前脚本的绝对路径 # 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__)) current_dir = os.path.dirname(os.path.abspath(__file__))
...@@ -10,25 +10,24 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -10,25 +10,24 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(预定配套件_path) sys.path.append(预定配套件_path)
# 导入模块 # 导入模块
try: try:
from 预定配套件.Base.app_base import *
from 预定配套件.Base.base import * from 预定配套件.Base.base import *
from 预定配套件.Base.app_base import *
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}") print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入") print("尝试使用绝对路径导入")
from 预定配套件.Base.app_base import *
from 预定配套件.Base.base import * from 预定配套件.Base.base import *
from 预定配套件.Base.app_base import *
def suite_setup(): def suite_setup():
STEP(1, "初始化设备adb连接") STEP(1, "初始化设备1的adb连接")
device_ip = '192.168.1.160' device_ip1 = '192.168.1.128'
app_init(device_ip) CHECK_POINT("设备1的adb连接初始化检测", app_init(device_ip1) == True)
# 检查设备adb连接状态
CHECK_POINT("设备1的adb连接初始化检测", app_init(device_ip) == True)
browser_init("展厅预定巡检") browser_init("展厅预定巡检")
wd = GSTORE['wd'] wd = GSTORE['wd']
def suite_teardown(): def suite_teardown():
device_ip = '192.168.1.160' device_ip1 = '192.168.5.156'
app_quit(device_ip) app_quit(device_ip1)
browser_quit() browser_quit()
\ No newline at end of file
import sys
import os
from 预定配套件.Base.app_base import find_element_with_retry
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定配套件_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..','..'))
# 添加路径
sys.path.append(预定配套件_path)
# 导入模块
from 预定配套件.Base.base import *
from 预定配套件.Base.app_base import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '..', '测试数据', '门口屏5.0测试用例.xlsx')
class DoorScreenDeployment:
tags = ['门口屏首次部署测试']
"""
执行指令是:
1.cd .\预定配套件\中控门口屏\
2.hytest --report_title 门口屏首次部署测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 门口屏首次部署测试
"""
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='首次安装部署',case_type="标准版")
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='首次安装部署', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self):
"""
执行测试步骤函数,主要用于执行读取的测试用例并进行会议预定界面操作
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
name = self.name
sleep(1)
# 初始化应用驱动,连接到指定的设备和应用
app_drive = app_setup_driver("Android", "11", "DoorScreen", "com.ubains.local.gviewer",
"com.ubains.ub.gview.SplashActivity", "192.168.1.128:5555")
app_drive.implicitly_wait(60) # 设置缺省等待时间
# 使用显式等待来等待元素出现
logging.info("等待首页加载...")
for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = app_get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result')
# 赋值灯带时间
sleep_time = step.get('sleep_time')
# 判断页面功能类型
if page_type == "Deployment":
if element_type == "input":
# 调用app输入函数
input_text_with_retry(app_drive,locator_type, locator_value,element_value)
sleep(sleep_time)
elif element_type == "click":
# 调用app点击函数
click_element_with_retry(app_drive, locator_type, locator_value)
sleep(sleep_time)
elif element_type == "getText":
# 调用app获取文本函数
element_text = get_text_with_retry(app_drive, locator_type, locator_value)
INFO(f"APP获取到的文本信息:{element_text}")
sleep(sleep_time)
\ No newline at end of file
import sys
import os
from time import sleep
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定配套件_path = os.path.abspath(os.path.join(current_dir, '..','..','..','..'))
# 添加路径
sys.path.append(预定配套件_path)
# 导入模块
try:
from 预定配套件.Base.base import *
from 预定配套件.Base.app_base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定配套件.Base.base import *
from 预定配套件.Base.app_base import *
def suite_setup():
STEP(1, "初始化设备1的adb连接")
device_ip1 = '192.168.1.128'
CHECK_POINT("设备1的adb连接初始化检测", app_init(device_ip1) == True)
browser_init("展厅预定巡检")
wd = GSTORE['wd']
def suite_teardown():
device_ip1 = '192.168.5.156'
app_quit(device_ip1)
browser_quit()
\ No newline at end of file
from appium.webdriver.common.appiumby import AppiumBy
from 预定系统.Base.app_base import *
import logging
from time import sleep
from hytest import *
# 配置日志记录
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
class DoorScreen:
"""
执行指令:
1.cd 预定系统
2.
"""
tags = ['门口屏测试']
def teststeps(self):
app_drive = None
wd = GSTORE['wd']
try:
app_drive = app_setup_driver("Android", "11", "门口屏测试", "com.ubains.local.gviewer", "com.ubains.ub.gview.SplashActivity","192.168.1.160:5555")
app_drive.implicitly_wait(20) # 设置缺省等待时间
except Exception as e:
logging.error(f"发生错误: {e}", exc_info=True)
\ No newline at end of file
...@@ -3,11 +3,97 @@ ...@@ -3,11 +3,97 @@
=== [ 收集测试用例 ] === === [ 收集测试用例 ] ===
== cases\测试目录\__st__.py == cases\01门口屏首次安装部署\__st__.py
== cases\测试目录\门口屏测试.py == cases\01门口屏首次安装部署\安装部署流程.py
行 4 的 JSON 数据: {
"name": "首次安装部署功能",
"para": [{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.EditText",
"element_type": "input",
"element_value": "192.168.5.235",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[2]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time": 10
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.EditText",
"element_type": "input",
"element_value": "测试会议室",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[1]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.TextView",
"element_type": "getText",
"element_value": "",
"expented_result": "测试会议室",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.FrameLayout",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[3]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[3]/android.widget.Button[2]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":10
}
]
}
XLSX文件已读取
=== [ 执行测试用例 ] === === [ 执行测试用例 ] ===
...@@ -16,22 +102,19 @@ ...@@ -16,22 +102,19 @@
========= 测试开始 : 20250414_181647 ========= ========= 测试开始 : 20250506_174611 =========
>>> cases\测试目录\ >>> cases\01门口屏首次安装部署\
[ suite setup ] cases\测试目录\ [ suite setup ] cases\01门口屏首次安装部署\
-- 第 1 步 -- 初始化设备adb连接 -- 第 1 步 -- 初始化设备1的adb连接
'----------' 正在初始化ADB连接 '----------' '----------' 正在初始化ADB连接 '----------'
尝试连接到设备: 192.168.1.160:5555 尝试连接到设备: 192.168.1.128:5555
设备 192.168.1.160:5555 已连接并可用 设备 192.168.1.128:5555 已连接并可用
'----------' 正在初始化ADB连接 '----------'
尝试连接到设备: 192.168.1.160:5555
设备 192.168.1.160:5555 已连接并可用
** 检查点 ** 设备1的adb连接初始化检测 ----> 通过 ** 检查点 ** 设备1的adb连接初始化检测 ----> 通过
...@@ -39,38 +122,9 @@ ...@@ -39,38 +122,9 @@
'----------' 浏览器初始化完成 '----------' '----------' 浏览器初始化完成 '----------'
>>> cases\测试目录\门口屏测试.py >>> cases\01门口屏首次安装部署\安装部署流程.py
* DoorScreen - 2025-04-14 18:16:49 * 首次安装部署功能 - 2025-05-06 17:46:13
[ case execution steps ] [ case execution steps ]
PASS APP获取到的文本信息:测试会议室
[ suite teardown ] cases\测试目录\
ADB 连接已断开: 192.168.1.160:5555
清除浏览器
========= 测试结束 : 20250414_181732 =========
耗时 : 44.542 秒
预备执行用例数量 : 1
实际执行用例数量 : 1
通过 : 1
失败 : 0
异常 : 0
套件初始化失败 : 0
套件清除 失败 : 0
用例初始化失败 : 0
用例清除 失败 : 0
...@@ -3,11 +3,97 @@ ...@@ -3,11 +3,97 @@
=== [ 收集测试用例 ] === === [ 收集测试用例 ] ===
== cases\测试目录\__st__.py == cases\01门口屏首次安装部署\__st__.py
== cases\测试目录\门口屏测试.py == cases\01门口屏首次安装部署\安装部署流程.py
行 4 的 JSON 数据: {
"name": "首次安装部署功能",
"para": [{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.EditText",
"element_type": "send",
"element_value": "192.168.5.235",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[2]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time": 10
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.EditText",
"element_type": "send",
"element_value": "测试会议室",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[1]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.TextView",
"element_type": "getText",
"element_value": "",
"expented_result": "测试会议室",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.FrameLayout",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[3]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[3]/android.widget.Button[2]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "XPATH",
"locator_value": "",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":10
}
]
}
XLSX文件已读取
=== [ 执行测试用例 ] === === [ 执行测试用例 ] ===
...@@ -16,22 +102,19 @@ ...@@ -16,22 +102,19 @@
========= 测试开始 : 20250414_181532 ========= ========= 测试开始 : 20250506_174427 =========
>>> cases\测试目录\ >>> cases\01门口屏首次安装部署\
[ suite setup ] cases\测试目录\ [ suite setup ] cases\01门口屏首次安装部署\
-- 第 1 步 -- 初始化设备adb连接 -- 第 1 步 -- 初始化设备1的adb连接
'----------' 正在初始化ADB连接 '----------' '----------' 正在初始化ADB连接 '----------'
尝试连接到设备: 192.168.1.160:5555 尝试连接到设备: 192.168.1.128:5555
设备 192.168.1.160:5555 已连接并可用 设备 192.168.1.128:5555 已连接并可用
'----------' 正在初始化ADB连接 '----------'
尝试连接到设备: 192.168.1.160:5555
设备 192.168.1.160:5555 已连接并可用
** 检查点 ** 设备1的adb连接初始化检测 ----> 通过 ** 检查点 ** 设备1的adb连接初始化检测 ----> 通过
...@@ -39,38 +122,8 @@ ...@@ -39,38 +122,8 @@
'----------' 浏览器初始化完成 '----------' '----------' 浏览器初始化完成 '----------'
>>> cases\测试目录\门口屏测试.py >>> cases\01门口屏首次安装部署\安装部署流程.py
* DoorScreen - 2025-04-14 18:15:34 * 首次安装部署功能 - 2025-05-06 17:44:29
[ case execution steps ] [ case execution steps ]
PASS
[ suite teardown ] cases\测试目录\
ADB 连接已断开: 192.168.1.160:5555
清除浏览器
========= 测试结束 : 20250414_181539 =========
耗时 : 6.960 秒
预备执行用例数量 : 1
实际执行用例数量 : 1
通过 : 1
失败 : 0
异常 : 0
套件初始化失败 : 0
套件清除 失败 : 0
用例初始化失败 : 0
用例清除 失败 : 0
...@@ -3,11 +3,97 @@ ...@@ -3,11 +3,97 @@
=== [ 收集测试用例 ] === === [ 收集测试用例 ] ===
== cases\测试目录\__st__.py == cases\01门口屏首次安装部署\__st__.py
== cases\测试目录\门口屏测试.py == cases\01门口屏首次安装部署\安装部署流程.py
行 4 的 JSON 数据: {
"name": "首次安装部署功能",
"para": [{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.EditText",
"element_type": "send",
"element_value": "192.168.5.235",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[2]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time": 10
},
{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.EditText",
"element_type": "send",
"element_value": "测试会议室",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[1]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.TextView",
"element_type": "getText",
"element_value": "",
"expented_result": "测试会议室",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.FrameLayout/androidx.recyclerview.widget.RecyclerView/android.widget.FrameLayout[1]/android.widget.FrameLayout/android.widget.FrameLayout",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[2]/android.widget.Button[3]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.FrameLayout[3]/android.widget.Button[2]",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":2
},
{
"page": "Deployment",
"locator_type": "xpath",
"locator_value": "",
"element_type": "click",
"element_value": "",
"expented_result": "",
"sleep_time":10
}
]
}
XLSX文件已读取
=== [ 执行测试用例 ] === === [ 执行测试用例 ] ===
...@@ -16,19 +102,19 @@ ...@@ -16,19 +102,19 @@
========= 测试开始 : 20250414_181513 ========= ========= 测试开始 : 20250506_174239 =========
>>> cases\测试目录\ >>> cases\01门口屏首次安装部署\
[ suite setup ] cases\测试目录\ [ suite setup ] cases\01门口屏首次安装部署\
-- 第 1 步 -- 初始化设备adb连接 -- 第 1 步 -- 初始化设备1的adb连接
'----------' 正在初始化ADB连接 '----------' '----------' 正在初始化ADB连接 '----------'
尝试连接到设备: 192.168.1.160:5555 尝试连接到设备: 192.168.1.128:5555
设备 192.168.1.160:5555 已连接并可用 设备 192.168.1.128:5555 已连接并可用
** 检查点 ** 设备1的adb连接初始化检测 ----> 通过 ** 检查点 ** 设备1的adb连接初始化检测 ----> 通过
...@@ -36,38 +122,8 @@ ...@@ -36,38 +122,8 @@
'----------' 浏览器初始化完成 '----------' '----------' 浏览器初始化完成 '----------'
>>> cases\测试目录\门口屏测试.py >>> cases\01门口屏首次安装部署\安装部署流程.py
* DoorScreen - 2025-04-14 18:15:15 * 首次安装部署功能 - 2025-05-06 17:42:41
[ case execution steps ] [ case execution steps ]
PASS
[ suite teardown ] cases\测试目录\
ADB 连接已断开: 192.168.1.160:5555
清除浏览器
========= 测试结束 : 20250414_181521 =========
耗时 : 7.758 秒
预备执行用例数量 : 1
实际执行用例数量 : 1
通过 : 1
失败 : 0
异常 : 0
套件初始化失败 : 0
套件清除 失败 : 0
用例初始化失败 : 0
用例清除 失败 : 0
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论