提交 4a865320 authored 作者: 陈泽健's avatar 陈泽健

补充读取测试用例JSON数据安卓信息、系统管理和信息发布模块的部分功能测试。处理优化富创项目的新需求topic主题与MQTT消息体。

上级 7d49d20c
......@@ -395,7 +395,11 @@ class Mqtt:
"startTime": config['startTime'],
"endTime": config['endTime'],
"companyNumber": config['companyNumber'],
"participantList": ["JiaoJiao", "JiaYu", "DuiFangZhengZaiZhangTouFa", "DuoTangMaLaBan", "DaLi", "500mlLingDu", "tt.", "wilbur"]
"participantList": ["JiaoJiao", "JiaYu", "DuiFangZhengZaiZhangTouFa", "DuoTangMaLaBan", "DaLi", "500mlLingDu", "tt.", "wilbur", "q"],
"signInBeforeMinutes": config['signInBeforeMinutes'],
"enableSignOut": config['enableSignOut'],
"signOutMinutesAfterSignIn": config['signOutMinutesAfterSignIn'],
"signOutAfterEndMinutes": config['signOutAfterEndMinutes']
}]
})
......@@ -411,11 +415,7 @@ class Mqtt:
# 根据 updateMethod 设置不同的背景图片字段
if config.get('updateMethod') == 'restoreDefault':
message['data']['updateMethod'] = 'restoreDefault'
# 判断背景图的类型是Base64还是URL
if "backgroundImageType" == "backgroundImageBase64":
message['data']['backgroundImageBase64'] = config['backgroundImageValue']
elif 'backgroundImageType' == "backgroundImageURL":
message['data']['backgroundImageURL'] = config['backgroundImageValue']
elif config.get('updateMethod') == 'single':
message['data']['updateMethod'] = 'single'
# 判断背景图的类型是Base64还是URL
......
......@@ -254,4 +254,5 @@
67. 2025-03-12
- 实现读取测试用例JSON数据全局配置、账号管理以及信息统计的部分功能测试。优化get_notify_text传参。
- 补充读取测试用例JSON数据会议审批和会议室管理的部分功能测试。优化message_meeting函数传参。
- 补充读取测试用例JSON数据授权码管理的部分功能测试。
\ No newline at end of file
- 补充读取测试用例JSON数据授权码管理的部分功能测试。
- 补充读取测试用例JSON数据安卓信息、系统管理和信息发布模块的部分功能测试。处理优化富创项目的新需求topic主题与MQTT消息体。
\ No newline at end of file
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class SMCMeeting_00x:
tags = ['新-会控SMC测试']
tags = ['新-会控SMC测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class TxcentMeeting_00x:
tags = ['新-会控腾讯测试']
tags = ['新-会控腾讯测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class EditMessage_00x:
tags = ['新-会议修改测试']
tags = ['新-会议修改测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MeetingMessage_00x:
tags = ['新-会议创建测试']
tags = ['新-会议创建测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class HistoryMessage_00x:
tags = ['新-会议历史记录测试']
tags = ['新-会议历史记录测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MessageApproval:
tags = ['新-会议审批测试']
tags = ['新-会议审批测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -18,7 +18,7 @@ xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议
class MeetingList_000x:
tags = ['新-会议室列表']
tags = ['新-会议室列表', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics:
tags = ['新-会议室管理测试']
tags = ['新-会议室管理测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MessageTemplate_00x:
tags = ['新-会议模板测试']
tags = ['新-会议模板测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
import sys
import os
# 获取当前脚本的绝对路径
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 *
def suite_setup():
STEP(1, "初始化浏览器")
# 初始化浏览器与系统地址
browser_init("标准版预定系统")
admin_login("admin@Test", "Ubains@4321")
sleep(2)
wd = GSTORE['wd']
# 进入后台模块
safe_click((By.XPATH, "//img[@title='后台系统']"),wd)
# 展开全局配置模块
safe_click((By.XPATH, "//span[contains(text(),'信息发布')]"), wd)
def suite_teardown():
wd = GSTORE['wd']
wd.quit()
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class AndroidInformation:
tags = ['新-信息发布测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 信息发布测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-信息发布测试
"""
def teststeps(self):
"""
执行测试步骤函数,主要用于执行读取的测试用例并进行安卓信息模块功能测试操作
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据
ddt_cases = read_xlsx_data(xlsx_file_path, "信息发布")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
for step in case:
print(f"当前步骤: {step}")
# 先赋值
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
# 判断页面功能类型
if step.get("page") == "AndroidInformation":
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
send_keyboard((locator_type, locator_value), wd)
sleep(2)
elif element_type == "getText":
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"获取的文本为:{notify_text}")
CHECK_POINT("判断当前界面是否正确", expented_result in notify_text)
\ No newline at end of file
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics:
tags = ['新-信息统计测试']
tags = ['新-信息统计测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class GlobalConfiguration:
tags = ['新-全局配置测试']
tags = ['新-全局配置测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
import sys
import os
# 获取当前脚本的绝对路径
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 *
def suite_setup():
STEP(1, "初始化浏览器")
# 初始化浏览器与系统地址
browser_init("标准版预定系统")
admin_login("admin@Test", "Ubains@4321")
sleep(2)
wd = GSTORE['wd']
# 进入后台模块
safe_click((By.XPATH, "//img[@title='后台系统']"),wd)
# 展开全局配置模块
safe_click((By.XPATH, "//span[contains(text(),'设备管理')]"), wd)
sleep(1)
# 进入全局配置界面
safe_click((By.XPATH, "//li[contains(text(),'安卓信息')]"), wd)
def suite_teardown():
wd = GSTORE['wd']
wd.quit()
\ No newline at end of file
import sys
import os
# 获取当前脚本的绝对路径
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 *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class AndroidInformation:
tags = ['新-安卓信息测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
2.hytest --report_title 安卓信息测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-安卓信息测试
"""
def teststeps(self):
"""
执行测试步骤函数,主要用于执行读取的测试用例并进行安卓信息模块功能测试操作
"""
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据
ddt_cases = read_xlsx_data(xlsx_file_path, "安卓信息")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
for step in case:
print(f"当前步骤: {step}")
# 先赋值
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
# 判断页面功能类型
if step.get("page") == "AndroidInformation":
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2)
elif element_type == "getText":
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"获取的文本为:{notify_text}")
CHECK_POINT("判断当前界面是否正确", expented_result in notify_text)
\ No newline at end of file
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class TokenManage:
tags = ['新-授权码管理测试']
tags = ['新-授权码管理测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
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, '..','..'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
from 预定系统.Base.base import *
def suite_setup():
STEP(1, "初始化浏览器")
# 初始化浏览器与系统地址
browser_init("标准版预定系统")
admin_login("admin@Test", "Ubains@4321")
sleep(2)
wd = GSTORE['wd']
admin_login("admin@ZDH", "Ubains@4321")
enter_the_backend()
INFO("打开系统管理下拉菜单")
# 进入后台模块
safe_click((By.XPATH, "//img[@title='后台系统']"), wd)
# 展开全局配置模块
safe_click((By.XPATH, "//span[contains(text(),'系统管理')]"), wd)
sleep(1)
INFO("进入系统设置模块")
safe_click((By.XPATH, "//li[contains(text(),'系统信息')]"), wd)
sleep(2)
\ No newline at end of file
def suite_teardown():
wd = GSTORE['wd']
wd.quit()
\ No newline at end of file
from time import sleep
from hytest import *
import sys
import os
# 获取当前脚本的绝对路径
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建预定系统的绝对路径
预定系统_path = os.path.abspath(os.path.join(current_dir, '..','..','..'))
预定系统_path = os.path.abspath(os.path.join(current_dir, '..', '..', '..'))
# 添加路径
sys.path.append(预定系统_path)
# 导入模块
try:
from 预定系统.Base.base import *
except ModuleNotFoundError as e:
print(f"ModuleNotFoundError: {e}")
print("尝试使用绝对路径导入")
from 预定系统.Base.base import *
from 预定系统.Base.base import *
# 获取当前脚本所在的目录
current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建CSV文件的绝对路径
csv_file_path = os.path.join(current_dir, '../../测试数据/系统设置模块/系统设置.csv')
class System_Setting_000x:
tags = ['系统设置功能','预定系统功能']
# 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class SystemManage:
tags = ['新-系统管理测试', 'JSON测试']
"""
执行指令:
执行指令
1.cd 预定系统
2.hytest --report_title 系统设置测试报告 --test 系统设置_001
2.hytest --report_title 系统管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-系统管理测试
"""
ddt_cases = read_csv_data(csv_file_path)
def teststeps(self):
"""
执行测试步骤以用户新增功能。
本函数根据参数输入账号、用户名、密码、确认密码、部门、性别、手机号和邮箱,并检查新增后的提示信息是否与预期相符。
执行测试步骤函数,主要用于执行读取的测试用例并进行系统管理模块功能测试操作
"""
# 初始化通知文本为空字符串
notify_fastdfs_text = ""
notify_mysql_text = ""
notify_redis_text = ""
version_qianduan_text = ""
version_houdaun_text = ""
# 从全局存储中获取webdriver实例
# 从全局存储中获取webdriver对象
wd = GSTORE['wd']
name = self.name
check_text = self.para
STEP(1, "检查fastDFS服务运行是否正常")
sleep(3)
notify_fastdfs_text = elment_get_text((By.XPATH,"(//div[@class='detail_content'][contains(text(),'正常启动')])[1]"), wd)
notify_mysql_text = elment_get_text((By.XPATH,"(//div[@class='detail_content'][contains(text(),'正常启动')])[2]"),wd)
notify_redis_text = elment_get_text((By.XPATH,"(//div[@class='detail_content'][contains(text(),'正常启动')])[3]"),wd)
INFO(f"fastDFS状态:{notify_fastdfs_text},mysql状态:{notify_mysql_text},redis状态:{notify_redis_text}")
# 读取Excel文件中的测试用例数据
ddt_cases = read_xlsx_data(xlsx_file_path, "系统管理")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
for step in case:
print(f"当前步骤: {step}")
# 先赋值
locator_type = get_by_enum(step.get('locator_type'))
locator_value = step.get('locator_value')
element_type = step.get('element_type')
element_value = step.get('element_value')
expented_result = step.get('expented_result')
version_qianduan_text = elment_get_text((By.XPATH,"/html/body/div[1]/div/div[2]/div[2]/div/div/div[2]/div[4]/div[1]/div/div"), wd)
version_houdaun_text = elment_get_text((By.XPATH,"/html/body/div[1]/div/div[2]/div[2]/div/div/div[2]/div[5]/div[1]/div/div"), wd)
INFO(f"前端版本:{version_qianduan_text},后端版本:{version_houdaun_text}")
# 判断页面功能类型
if step.get("page") == "SystemLog":
# 判断page为系统日志界面,点击【系统日志】,进入系统日志模块
safe_click((By.XPATH, "//li[contains(text(),'系统日志')]"), wd)
sleep(1)
# CHECK_POINT("检查fastDFS服务运行", check_text in notify_fastdfs_text)
# CHECK_POINT("检查mysql服务运行", check_text in notify_mysql_text)
# CHECK_POINT("检查redis服务运行", check_text in notify_redis_text)
\ No newline at end of file
if element_type == "click":
safe_click((locator_type, locator_value), wd)
sleep(2)
elif element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2)
elif element_type == "getText":
notify_text = elment_get_text((locator_type,locator_value), wd)
INFO(f"获取的文本为:{notify_text}")
CHECK_POINT("判断当前界面是否正确", expented_result in notify_text)
\ No newline at end of file
......@@ -17,7 +17,7 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics:
tags = ['新-账号管理测试']
tags = ['新-账号管理测试', 'JSON测试']
"""
执行指令是:
1.cd 预定系统
......
此差异已折叠。
此差异已折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论