提交 6ec99032 authored 作者: 陈泽健's avatar 陈泽健

处理会议测试用例所有模块的JSON数据格式以及代码处理,规范化类名。

上级 93803d12
...@@ -269,3 +269,4 @@ ...@@ -269,3 +269,4 @@
- 补充write_xlsx_data函数用以将测试结果与日志截图写入到xlsx测试用例文件中。调试write_xlsx_data函数与统一平台的窗口切换关闭。 - 补充write_xlsx_data函数用以将测试结果与日志截图写入到xlsx测试用例文件中。调试write_xlsx_data函数与统一平台的窗口切换关闭。
72. 2025-03-24 72. 2025-03-24
- 优化write_xlsx_data函数实现表格自动填充测试结果和日志截图功能。 - 优化write_xlsx_data函数实现表格自动填充测试结果和日志截图功能。
- 处理会议测试用例所有模块的JSON数据格式以及代码处理,规范化类名。
\ No newline at end of file
...@@ -23,27 +23,30 @@ class AIMeeting: ...@@ -23,27 +23,30 @@ class AIMeeting:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title AI创会测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-AI创会测试 2.hytest --report_title AI创会测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-AI创会测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='AI创会')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='AI创会', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
ddt_cases = read_xlsx_data(xlsx_file_path, "AI创会") name = self.name
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
page_type = step.get('page')
for step in case: # 赋值元素定位类型,并将字符串转为Enum类型
print(f"当前步骤: {step}")
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 将会议名称赋值,后面调用函数结束会议
message_name = element_value
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "AIMeeting": if page_type == "AIMeeting":
if element_type == "input": if element_type == "input":
# 查询会议 # 查询会议
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
......
...@@ -16,36 +16,42 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,36 +16,42 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class SMCMeeting_00x: class SMCMeeting:
tags = ['新-会控SMC测试', 'JSON测试'] tags = ['新-会控SMC测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会控SMC测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会控SMC测试 2.hytest --report_title 会控SMC测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会控SMC测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会控-SMC')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会控-SMC', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
ddt_cases = read_xlsx_data(xlsx_file_path, "会控-SMC") name = self.name
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数 # 调用会议创建函数
meeting_message("SMC会议室", "SMC3.0", "SMC3.0", "标准版", wd) meeting_message("SMC会议室", "SMC3.0", "SMC3.0", "标准版", wd)
sleep(1) sleep(1)
for step in case:
print(f"当前步骤: {step}") for step in self.para:
# 先赋值 # 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 将会议名称赋值,后面调用函数结束会议 # 将会议名称赋值,后面调用函数结束会议
message_name = element_value message_name = element_value
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "MeetingControl_SMC": if page_type == "MeetingControl_SMC":
if element_type == "input": if element_type == "input":
# 查询会议 # 查询会议
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
......
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class TxcentMeeting_00x: class TxcentMeeting:
tags = ['新-会控腾讯测试', 'JSON测试'] tags = ['新-会控腾讯测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 腾讯会控测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会控腾讯测试 2.hytest --report_title 腾讯会控测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会控腾讯测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会控-腾讯会议')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会控-腾讯会议', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,26 +33,30 @@ class TxcentMeeting_00x: ...@@ -30,26 +33,30 @@ class TxcentMeeting_00x:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "会控-腾讯会议")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数 # 调用会议创建函数
meeting_message("腾讯会议室", "腾讯会议", "腾讯会议","标准版", wd) meeting_message("腾讯会议室", "腾讯会议", "腾讯会议", "标准版", wd)
sleep(1) sleep(1)
for step in case:
print(f"当前步骤: {step}") for step in self.para:
# 先赋值 # 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 将会议名称赋值,后面调用函数结束会议 # 将会议名称赋值,后面调用函数结束会议
message_name = element_value message_name = element_value
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "MeetingControl_Txcent": if page_type == "MeetingControl_Txcent":
if element_type == "input": if element_type == "input":
# 查询会议 # 查询会议
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
...@@ -70,7 +77,7 @@ class TxcentMeeting_00x: ...@@ -70,7 +77,7 @@ class TxcentMeeting_00x:
elif element_type == "getText": elif element_type == "getText":
# 切换到新窗口 # 切换到新窗口
wd.switch_to.window(wd.window_handles[1]) wd.switch_to.window(wd.window_handles[1])
notify_text = elment_get_text((locator_type,locator_value), wd) notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"当前页面标题为:{notify_text}") INFO(f"当前页面标题为:{notify_text}")
CHECK_POINT(f"当前页面标题为:{notify_text}", expented_result in notify_text) CHECK_POINT(f"当前页面标题为:{notify_text}", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50") SELENIUM_LOG_SCREEN(wd, "50")
......
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class EditMessage_00x: class EditMessage:
tags = ['新-会议修改测试', 'JSON测试'] tags = ['新-会议修改测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会议修改测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议修改测试 2.hytest --report_title 会议修改测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议修改测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议修改')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议修改', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,12 +33,10 @@ class EditMessage_00x: ...@@ -30,12 +33,10 @@ class EditMessage_00x:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "会议修改")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用会议创建函数 # 调用会议创建函数
meeting_message("预约会议室", "普通会议", "普通会议","标准版", wd) meeting_message("预约会议室", "普通会议", "普通会议", "标准版", wd)
# 搜索会议 # 搜索会议
safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "普通会议", wd) safe_send_keys((By.XPATH, "//input[@placeholder='输入关键字搜索']"), "普通会议", wd)
send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd) send_keyboard((By.XPATH, "//input[@placeholder='输入关键字搜索']"), wd)
...@@ -43,19 +44,24 @@ class EditMessage_00x: ...@@ -43,19 +44,24 @@ class EditMessage_00x:
# 点击会议修改按钮 # 点击会议修改按钮
safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'修改会议')]"), wd) safe_click((By.XPATH, "//button[@type='button']//span[contains(text(),'修改会议')]"), wd)
for step in case: for step in self.para:
print(f"当前步骤: {step}") # 赋值页面类型page
# 先赋值 page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 将会议名称赋值,后面调用函数结束会议 # 将会议名称赋值,后面调用函数结束会议
message_name = element_value message_name = element_value
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "MessageNameTest": if page_type == "MessageNameTest":
# 这是会议名称字符测试用例 # 这是会议名称字符测试用例
if element_type == "input": if element_type == "input":
# 输入会议名称 # 输入会议名称
...@@ -63,6 +69,7 @@ class EditMessage_00x: ...@@ -63,6 +69,7 @@ class EditMessage_00x:
sleep(1) sleep(1)
elif element_type == "click": elif element_type == "click":
safe_click((locator_type, locator_value), wd)
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
......
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MeetingMessage_00x: class MeetingMessage:
tags = ['新-会议创建测试', 'JSON测试'] tags = ['新-会议创建测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会议创建测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议创建测试 2.hytest --report_title 会议创建测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议创建测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议创建')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议创建', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,26 +33,30 @@ class MeetingMessage_00x: ...@@ -30,26 +33,30 @@ class MeetingMessage_00x:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "会议创建")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 调用进入会议预定界面函数 # 调用进入会议预定界面函数
enter_meeting_booking_page("预约会议室", wd) enter_meeting_booking_page("预约会议室", wd)
sleep(1) sleep(1)
for step in case:
print(f"当前步骤: {step}") for step in self.para:
# 先赋值 # 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 将会议名称赋值,后面调用函数结束会议 # 将会议名称赋值,后面调用函数结束会议
message_name = element_value message_name = element_value
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "MessageNameTest": if page_type == "MessageNameTest":
# 这是会议名称字符测试用例 # 这是会议名称字符测试用例
if element_type == "input": if element_type == "input":
# 输入会议名称 # 输入会议名称
......
...@@ -16,43 +16,51 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,43 +16,51 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class HistoryMessage_00x: class HistoryMessage:
tags = ['新-会议历史记录测试', 'JSON测试'] tags = ['新-会议历史记录测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会议历史记录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议历史记录测试 2.hytest --report_title 会议历史记录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议历史记录测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议历史记录')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议历史记录', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
执行测试步骤函数,主要用于执行读取的测试用例并进行会议预定界面操作 执行测试步骤函数,主要用于执行读取的测试用例并进行会议历史记录界面操作
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "会议历史记录")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "MessageQuery": if page_type == "MessageQuery":
# 这是会议名称字符测试用例 # 这是会议名称字符测试用例
if element_type == "input": if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2) sleep(2)
elif element_type == "click": elif element_type == "click":
# 点击按钮 # 点击按钮
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
elif element_type == "getText": elif element_type == "getText":
# 获取列表筛选数据 # 获取列表筛选数据
notify_text = elment_get_text((locator_type, locator_value), wd) notify_text = elment_get_text((locator_type, locator_value), wd)
......
...@@ -23,6 +23,9 @@ class MessageApproval: ...@@ -23,6 +23,9 @@ class MessageApproval:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会议审批测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议审批测试 2.hytest --report_title 会议审批测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议审批测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议审批')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议审批', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,34 +33,39 @@ class MessageApproval: ...@@ -30,34 +33,39 @@ class MessageApproval:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "会议审批")
# 遍历 ddt_cases 并获取每一个 JSON 对象
for case in ddt_cases:
# 创建审批会议 # 创建审批会议
meeting_message("审批会议室", "普通会议", "审批测试会议","标准版", wd) meeting_message("审批会议室", "普通会议", "审批测试会议", "标准版", wd)
for step in case:
print(f"当前步骤: {step}") for step in self.para:
# 先赋值 # 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "ApprovalInitiate": if page_type == "ApprovalInitiate":
# 这是编辑模板测试 # 这是编辑模板测试
if element_type == "input": if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(1) sleep(1)
elif element_type == "click": elif element_type == "click":
safe_click((locator_type, locator_value), wd)
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
elif element_type == "getTips": elif element_type == "getTips":
notify_text = get_notify_text(wd, (locator_type, locator_value), "Message_Template", "Template_Edit", "编辑模板") notify_text = get_notify_text(wd, (locator_type, locator_value), "Message_Template",
"Template_Edit", "编辑模板")
INFO(f"提示信息为:{notify_text}") INFO(f"提示信息为:{notify_text}")
CHECK_POINT("编辑测试判断是否正确", expented_result in notify_text) CHECK_POINT("编辑测试判断是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50") SELENIUM_LOG_SCREEN(wd, "50")
...@@ -71,4 +79,6 @@ class MessageApproval: ...@@ -71,4 +79,6 @@ class MessageApproval:
# 取消审批会议数据 # 取消审批会议数据
safe_click((By.XPATH, "//span[contains(text(),'取消审批')]"), wd) safe_click((By.XPATH, "//span[contains(text(),'取消审批')]"), wd)
sleep(1) sleep(1)
safe_click((By.XPATH, "//button[contains(@class,'el-button el-button--default el-button--small el-button--primary')]//span[contains(text(),'确定')]"), wd) safe_click((By.XPATH,
\ No newline at end of file "//button[contains(@class,'el-button el-button--default el-button--small el-button--primary')]//span[contains(text(),'确定')]"),
wd)
\ No newline at end of file
...@@ -17,30 +17,36 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -17,30 +17,36 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MeetingList_000x: class MeetingRoomList:
tags = ['新-会议室列表', 'JSON测试'] tags = ['新-会议室列表', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 账号密码登录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议室列表 2.hytest --report_title 账号密码登录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议室列表
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议室列表')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议室列表', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
wd = GSTORE['wd'] wd = GSTORE['wd']
ddt_cases = read_xlsx_data(xlsx_file_path,"会议室列表") name = self.name
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
if "MeetingRoomToken" in step.get("page"):
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
if page_type == "MeetingList_MeetingRoomToken":
if element_type == "input": if element_type == "input":
# 点击展开筛选界面 # 点击展开筛选界面
STEP(1, "搜索会议室") STEP(1, "搜索会议室")
......
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics: class ConferenceRoomManagement:
tags = ['新-会议室管理测试', 'JSON测试'] tags = ['新-会议室管理测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会议室管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议室管理测试 2.hytest --report_title 会议室管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议室管理测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议室管理')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议室管理', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class ConferenceStatistics: ...@@ -30,21 +33,24 @@ class ConferenceStatistics:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "会议室管理")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "ConferenceManageQuery": if page_type == "ConferenceManageQuery":
safe_click((By.XPATH, "//li[contains(text(),'会议室管理')]"), wd) safe_click((By.XPATH, "//li[contains(text(),'会议室管理')]"), wd)
if element_type == "click": if element_type == "click":
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
......
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class MessageTemplate_00x: class MessageTemplate:
tags = ['新-会议模板测试', 'JSON测试'] tags = ['新-会议模板测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会议模板测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议模板测试 2.hytest --report_title 会议模板测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-会议模板测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议模板')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议模板', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class MessageTemplate_00x: ...@@ -30,21 +33,24 @@ class MessageTemplate_00x:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "会议模板")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "EditTemplate": if page_type== "EditTemplate":
# 这是编辑模板测试 # 这是编辑模板测试
if element_type == "input": if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
...@@ -53,7 +59,8 @@ class MessageTemplate_00x: ...@@ -53,7 +59,8 @@ class MessageTemplate_00x:
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
elif element_type == "getTips": elif element_type == "getTips":
notify_text = get_notify_text(wd, (locator_type, locator_value), "Message_Template", "Template_Edit", "编辑模板") notify_text = get_notify_text(wd, (locator_type, locator_value), "Message_Template",
"Template_Edit", "编辑模板")
INFO(f"提示信息为:{notify_text}") INFO(f"提示信息为:{notify_text}")
CHECK_POINT("编辑测试判断是否正确", expented_result in notify_text) CHECK_POINT("编辑测试判断是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50") SELENIUM_LOG_SCREEN(wd, "50")
......
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class AndroidInformation: class InformationDelivery:
tags = ['新-信息发布测试', 'JSON测试'] tags = ['新-信息发布测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 信息发布测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-信息发布测试 2.hytest --report_title 信息发布测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-信息发布测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='信息发布')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='信息发布', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class AndroidInformation: ...@@ -30,21 +33,24 @@ class AndroidInformation:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "信息发布")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "AndroidInformation": if page_type == "MaterialManagement":
if element_type == "click": if element_type == "click":
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
...@@ -53,7 +59,7 @@ class AndroidInformation: ...@@ -53,7 +59,7 @@ class AndroidInformation:
send_keyboard((locator_type, locator_value), wd) send_keyboard((locator_type, locator_value), wd)
sleep(2) sleep(2)
elif element_type == "getText": elif element_type == "getText":
notify_text = elment_get_text((locator_type,locator_value), wd) notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"获取的文本为:{notify_text}") INFO(f"获取的文本为:{notify_text}")
CHECK_POINT("判断当前界面是否正确", expented_result in notify_text) CHECK_POINT("判断当前界面是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50") SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics: class InformationStatistics:
tags = ['新-信息统计测试', 'JSON测试'] tags = ['新-信息统计测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 信息统计测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-信息统计测试 2.hytest --report_title 信息统计测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-信息统计测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='信息统计')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='信息统计', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class ConferenceStatistics: ...@@ -30,21 +33,24 @@ class ConferenceStatistics:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "信息统计")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面page类型
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "ConferenceStatistics": if page_type == "ConferenceStatistics":
if element_type == "click": if element_type == "click":
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(1) sleep(1)
......
...@@ -23,6 +23,9 @@ class GlobalConfiguration: ...@@ -23,6 +23,9 @@ class GlobalConfiguration:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 全局配置测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-全局配置测试 2.hytest --report_title 全局配置测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-全局配置测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='全局配置')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='全局配置', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class GlobalConfiguration: ...@@ -30,21 +33,24 @@ class GlobalConfiguration:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "全局配置")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "GlobalConfiguration": if page_type == "GlobalConfiguration":
if element_type == "click": if element_type == "click":
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
......
...@@ -23,6 +23,9 @@ class AndroidInformation: ...@@ -23,6 +23,9 @@ class AndroidInformation:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 安卓信息测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-安卓信息测试 2.hytest --report_title 安卓信息测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-安卓信息测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='安卓信息')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='安卓信息', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class AndroidInformation: ...@@ -30,21 +33,24 @@ class AndroidInformation:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "安卓信息")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "AndroidInformation": if page_type == "AndroidInformation":
if element_type == "click": if element_type == "click":
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
...@@ -52,7 +58,7 @@ class AndroidInformation: ...@@ -52,7 +58,7 @@ class AndroidInformation:
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2) sleep(2)
elif element_type == "getText": elif element_type == "getText":
notify_text = elment_get_text((locator_type,locator_value), wd) notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"获取的文本为:{notify_text}") INFO(f"获取的文本为:{notify_text}")
CHECK_POINT("判断当前界面是否正确", expented_result in notify_text) CHECK_POINT("判断当前界面是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50") SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
...@@ -24,11 +24,11 @@ csv_file_path = os.path.join(current_dir, '../../../测试数据/展厅巡检/ ...@@ -24,11 +24,11 @@ csv_file_path = os.path.join(current_dir, '../../../测试数据/展厅巡检/
# 定义时间格式 # 定义时间格式
time_format = "%H:%M" time_format = "%H:%M"
class Exhibition_hall_inspection_000x: class Exhibition_hall_inspection:
""" """
执行指令: 执行指令:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 会议预约测试报告 --report_url_prefix http://192.168.1.225 --test 展厅巡检_0** 2.hytest --report_title 展厅会议预约测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 展厅巡检会议系统
""" """
tags = ['展厅巡检','展厅巡检会议系统'] tags = ['展厅巡检','展厅巡检会议系统']
ddt_cases = read_csv_data(csv_file_path) ddt_cases = read_csv_data(csv_file_path)
...@@ -87,8 +87,8 @@ class Exhibition_hall_inspection_000x: ...@@ -87,8 +87,8 @@ class Exhibition_hall_inspection_000x:
sleep(1) sleep(1)
# 调用函数添加议题 # 调用函数添加议题
# INFO("添加议题文件") INFO("添加议题文件")
# issue_send_and_upload(wd, 5, issue_name) issue_send_and_upload(wd, 5, issue_name)
sleep(2) sleep(2)
# 选择签到时间 # 选择签到时间
......
...@@ -118,9 +118,11 @@ class Exhibition_Meeting_Control_0001: ...@@ -118,9 +118,11 @@ class Exhibition_Meeting_Control_0001:
sleep(1) sleep(1)
safe_send_keys((By.XPATH, "//input[@id='input_checkin']"), "30", wd) safe_send_keys((By.XPATH, "//input[@id='input_checkin']"), "30", wd)
# 根据开始时间选择8点30 # 调用函数根据当前时间进行选择
safe_click((By.XPATH, f"(//div[normalize-space()='08:30'])[1]"), wd) current_time = get_current_time_formatted()
safe_click((By.XPATH, f"(//div[normalize-space()='08:45'])[1]"), wd) INFO(f"获取当前的时间{current_time}")
safe_click((By.XPATH, f"//div[normalize-space()='{current_time}']"), wd)
sleep(1)
# 在会议预定第二步界面进行数据填入 # 在会议预定第二步界面进行数据填入
STEP(4, "会议第二步数据填写") STEP(4, "会议第二步数据填写")
......
...@@ -23,6 +23,9 @@ class TokenManage: ...@@ -23,6 +23,9 @@ class TokenManage:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 授权码管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-授权码管理测试 2.hytest --report_title 授权码管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-授权码管理测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='授权码管理')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='授权码管理', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class TokenManage: ...@@ -30,21 +33,24 @@ class TokenManage:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "授权码管理")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "TokenManage": if page_type == "TokenManage":
if element_type == "click": if element_type == "click":
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
......
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class Login_00x: class Login:
tags = ['新-登录测试'] tags = ['新-登录测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 账号密码登录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-登录测试 2.hytest --report_title 账号密码登录测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-登录测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='登录页面')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='登录页面', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,20 +33,20 @@ class Login_00x: ...@@ -30,20 +33,20 @@ class Login_00x:
本函数根据参数输入账号、密码和验证码,并检查登录后的提示信息是否与预期相符。 本函数根据参数输入账号、密码和验证码,并检查登录后的提示信息是否与预期相符。
""" """
wd = GSTORE['wd'] wd = GSTORE['wd']
ddt_cases = read_xlsx_data(xlsx_file_path, "登录页面") name = self.name
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 你可以在这里对 step 进行进一步处理
# 例如:访问特定字段
# page = step.get('page')
# 调用get_by_enum将定位类型转为枚举
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
if element_type == 'input': if element_type == 'input':
......
...@@ -23,6 +23,9 @@ class SystemManage: ...@@ -23,6 +23,9 @@ class SystemManage:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 系统管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-系统管理测试 2.hytest --report_title 系统管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-系统管理测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='系统管理')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='系统管理', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class SystemManage: ...@@ -30,21 +33,24 @@ class SystemManage:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "系统管理")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "SystemLog": if page_type == "SystemLog":
# 判断page为系统日志界面,点击【系统日志】,进入系统日志模块 # 判断page为系统日志界面,点击【系统日志】,进入系统日志模块
safe_click((By.XPATH, "//li[contains(text(),'系统日志')]"), wd) safe_click((By.XPATH, "//li[contains(text(),'系统日志')]"), wd)
sleep(1) sleep(1)
...@@ -56,7 +62,7 @@ class SystemManage: ...@@ -56,7 +62,7 @@ class SystemManage:
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
sleep(2) sleep(2)
elif element_type == "getText": elif element_type == "getText":
notify_text = elment_get_text((locator_type,locator_value), wd) notify_text = elment_get_text((locator_type, locator_value), wd)
INFO(f"获取的文本为:{notify_text}") INFO(f"获取的文本为:{notify_text}")
CHECK_POINT("判断当前界面是否正确", expented_result in notify_text) CHECK_POINT("判断当前界面是否正确", expented_result in notify_text)
SELENIUM_LOG_SCREEN(wd, "50") SELENIUM_LOG_SCREEN(wd, "50")
\ No newline at end of file
...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__)) ...@@ -16,13 +16,16 @@ current_dir = os.path.dirname(os.path.abspath(__file__))
# 构建XLSX文件的绝对路径 # 构建XLSX文件的绝对路径
xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx') xlsx_file_path = os.path.join(current_dir, '..', '..', '测试数据', '会议预定测试用例.xlsx')
class ConferenceStatistics: class AccountManagement:
tags = ['新-账号管理测试', 'JSON测试'] tags = ['新-账号管理测试', 'JSON测试']
""" """
执行指令是: 执行指令是:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 账号管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-账号管理测试 2.hytest --report_title 账号管理测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 新-账号管理测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='账号管理')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='账号管理', columns_to_clear=['测试结果', '测试频次', '日志截图'])
def teststeps(self): def teststeps(self):
""" """
...@@ -30,21 +33,24 @@ class ConferenceStatistics: ...@@ -30,21 +33,24 @@ class ConferenceStatistics:
""" """
# 从全局存储中获取webdriver对象 # 从全局存储中获取webdriver对象
wd = GSTORE['wd'] wd = GSTORE['wd']
# 读取Excel文件中的测试用例数据 name = self.name
ddt_cases = read_xlsx_data(xlsx_file_path, "账号管理")
# 遍历 ddt_cases 并获取每一个 JSON 对象 for step in self.para:
for case in ddt_cases: # 赋值页面类型page
for step in case: page_type = step.get('page')
print(f"当前步骤: {step}") # 赋值元素定位类型,并将字符串转为Enum类型
# 先赋值
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值
locator_value = step.get('locator_value') locator_value = step.get('locator_value')
# 赋值元素类型,例如:click点击、input输入框等
element_type = step.get('element_type') element_type = step.get('element_type')
# 赋值元素值,例如输入框的输入值
element_value = step.get('element_value') element_value = step.get('element_value')
# 赋值预期结果
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "CompanyManagement": if page_type == "CompanyManagement":
if element_type == "click": if element_type == "click":
safe_click((locator_type, locator_value), wd) safe_click((locator_type, locator_value), wd)
sleep(2) sleep(2)
......
...@@ -20,7 +20,6 @@ class ChangAnMessageApproval: ...@@ -20,7 +20,6 @@ class ChangAnMessageApproval:
1.cd 预定系统 1.cd 预定系统
2.hytest --report_title 长安大学取消审批测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 长安大学取消审批测试 2.hytest --report_title 长安大学取消审批测试报告 --report_url_prefix http://nat.ubainsyun.com:31133 --tag 长安大学取消审批测试
""" """
ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议审批') ddt_cases = read_xlsx_data(xlsx_file_path, sheet_name='会议审批')
# 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空 # 测试开始前调用clear_columns_in_xlsx函数,将测试用例中的测试结果和日志截图置空
clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议审批',columns_to_clear=['测试结果', '测试频次', '日志截图']) clear_columns_in_xlsx(xlsx_file_path, sheet_name='会议审批',columns_to_clear=['测试结果', '测试频次', '日志截图'])
...@@ -36,6 +35,8 @@ class ChangAnMessageApproval: ...@@ -36,6 +35,8 @@ class ChangAnMessageApproval:
meeting_message("审批会议室", "普通会议", "审批测试会议", "长安大学", wd) meeting_message("审批会议室", "普通会议", "审批测试会议", "长安大学", wd)
for step in self.para: for step in self.para:
# 赋值页面类型page
page_type = step.get('page')
# 赋值元素定位类型,并将字符串转为Enum类型 # 赋值元素定位类型,并将字符串转为Enum类型
locator_type = get_by_enum(step.get('locator_type')) locator_type = get_by_enum(step.get('locator_type'))
# 赋值元素值 # 赋值元素值
...@@ -48,7 +49,7 @@ class ChangAnMessageApproval: ...@@ -48,7 +49,7 @@ class ChangAnMessageApproval:
expented_result = step.get('expented_result') expented_result = step.get('expented_result')
# 判断页面功能类型 # 判断页面功能类型
if step.get("page") == "ApprovalInitiate": if page_type == "ApprovalInitiate":
if element_type == "input": if element_type == "input":
safe_send_keys((locator_type, locator_value), element_value, wd) safe_send_keys((locator_type, locator_value), element_value, wd)
......
name,conference_name,message_name,book_type,issue_name,book_start_time,book_end_time,message_notification,check_text name,conference_name,message_name,book_type,issue_name,book_start_time,book_end_time,message_notification,check_text
展厅巡检_001,MeetingRoom,展厅巡检测试,普通会议,议题1,08:00,08:15,开会前一天提醒,预定成功 展厅巡检_001,展厅会议室,展厅巡检测试,普通会议,议题1,08:00,08:15,开会前一天提醒,预定成功
\ No newline at end of file \ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论