diff options
| author | dongxiaoyan <[email protected]> | 2021-08-03 19:32:24 +0800 |
|---|---|---|
| committer | dongxiaoyan <[email protected]> | 2021-08-03 19:32:24 +0800 |
| commit | 950444d646bb4a21b6e70cfb534c3b269c51548d (patch) | |
| tree | db6dc0978bcbf35089df38cdc94758b55cc43850 | |
| parent | e4adcc588e92567f94ceb97196e739c7a8f131d3 (diff) | |
24 files changed, 1625 insertions, 0 deletions
diff --git a/.pydevproject b/.pydevproject new file mode 100644 index 0000000..98ee0df --- /dev/null +++ b/.pydevproject @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse-pydev version="1.0"?><pydev_project>
+ <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
+ <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python interpreter</pydev_property>
+</pydev_project>
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..9d3df88 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1
+encoding//01-TestCase/zjj/DLL-DeviceID-Test.robot=UTF-8
+encoding//02-Keyword/tsg_bfapi/policy_object/ProcessPolicyBody.robot=UTF-8
+encoding//customlib/common_Run.py=utf-8
+encoding/<project>=UTF-8
diff --git a/case/administration/user.robot b/case/administration/user.robot new file mode 100644 index 0000000..4e50599 --- /dev/null +++ b/case/administration/user.robot @@ -0,0 +1,64 @@ +****** Settings ***
+Library yaml
+Library OperatingSystem
+Library Selenium2Library
+Resource ../../variable/common_variable.txt
+Resource ../../keyword/common/page.robot
+
+*** Variables ***
+
+*** Test Cases ***
+# user正向用例
+user
+ log ${TEST NAME}
+ # 读取模板文件内容
+ ${yamltemplate} YamlLoad ${path}/data/template/page_template.yaml
+ ${objtemplate} Get From Dictionary ${yamltemplate} ${TEST NAME}_page
+ # 读取数据文件内容
+ ${yamlData} YamlLoad ${path}/data/administration/user_data.yaml
+ ${objDataList} Get From Dictionary ${yamlData} ${TEST NAME}_data
+ # 读取模板文件中OpenCreateOrEditPageIds中的数据(打开页面)
+ ${openCreateOrEditPageIds} Get From Dictionary ${objtemplate} openCreateOrEditPage
+ # 读取模板文件中PageData中的数据(打开页面)
+ ${tempData} Get From Dictionary ${objtemplate} templateData
+ ${OkOrCance} Get From Dictionary ${objtemplate} okOrCancel
+ FOR ${objData} IN @{objDataList}
+ ${pageData} CreateOrEditPage ${tempData} ${objData} ${openCreateOrEditPageIds} ${OkOrCance}
+
+ END
+
+#验证列设置功能
+user_column_setup
+ log ${TEST NAME}
+ # 读取模板文件内容
+ ${yamltemplate} YamlLoad ${path}/data/template/page_template.yaml
+ ${objtemplate} Get From Dictionary ${yamltemplate} user_page
+ # 读取数据文件内容
+ ${yamlData} YamlLoad ${path}/data/administration/user_data.yaml
+ ${objDataList} Get From Dictionary ${yamlData} ${TEST NAME}_data
+ # 读取模板文件中OpenCreateOrEditPageIds中的数据(打开页面)
+ ${tempData} Get From Dictionary ${objtemplate} templateData
+ ${openCreateOrEditPageIds} Get From Dictionary ${objtemplate} openCreateOrEditPage
+ FOR ${objData} IN @{objDataList}
+ ColumnSetup ${openCreateOrEditPageIds} ${objData} ${tempData}
+ END
+
+# 翻页功能验证
+user_turn_page
+ log ${TEST NAME}
+ # 读取模板文件内容
+ ${yamltemplate} YamlLoad ${path}/data/template/page_template.yaml
+ ${objtemplate} Get From Dictionary ${yamltemplate} user_page
+
+ ${openCreateOrEditPageIds} Get From Dictionary ${objtemplate} openCreateOrEditPage
+ ${okOrCancel} Get From Dictionary ${objtemplate} okOrCancel
+ TurnPage ${openCreateOrEditPageIds} ${okOrCancel}
+
+# 验证user页面账号日志功能
+user_operation_log
+ log ${TEST NAME}
+ # 读取模板文件内容
+ ${yamltemplate} YamlLoad ${path}/data/template/page_template.yaml
+ ${objtemplate} Get From Dictionary ${yamltemplate} user_page
+ ${openCreateOrEditPageIds} Get From Dictionary ${objtemplate} openCreateOrEditPage
+ UserOperationLog ${openCreateOrEditPageIds}
\ No newline at end of file diff --git a/customlib/common/__pycache__/common.cpython-36.pyc b/customlib/common/__pycache__/common.cpython-36.pyc Binary files differnew file mode 100644 index 0000000..365d645 --- /dev/null +++ b/customlib/common/__pycache__/common.cpython-36.pyc diff --git a/customlib/common/__pycache__/common.cpython-37.pyc b/customlib/common/__pycache__/common.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..a3dbf44 --- /dev/null +++ b/customlib/common/__pycache__/common.cpython-37.pyc diff --git a/customlib/common/__pycache__/type_judgment.cpython-36.pyc b/customlib/common/__pycache__/type_judgment.cpython-36.pyc Binary files differnew file mode 100644 index 0000000..078137a --- /dev/null +++ b/customlib/common/__pycache__/type_judgment.cpython-36.pyc diff --git a/customlib/common/__pycache__/type_judgment.cpython-37.pyc b/customlib/common/__pycache__/type_judgment.cpython-37.pyc Binary files differnew file mode 100644 index 0000000..75d0897 --- /dev/null +++ b/customlib/common/__pycache__/type_judgment.cpython-37.pyc diff --git a/customlib/common/__pycache__/util.cpython-36.pyc b/customlib/common/__pycache__/util.cpython-36.pyc Binary files differnew file mode 100644 index 0000000..f849b62 --- /dev/null +++ b/customlib/common/__pycache__/util.cpython-36.pyc diff --git a/customlib/common/common.py b/customlib/common/common.py new file mode 100644 index 0000000..2d282ed --- /dev/null +++ b/customlib/common/common.py @@ -0,0 +1,51 @@ +import json
+import random
+import hashlib
+import os
+
+#判断一个字符或字符串是否包含于另一个字符串:a是否再b中,是否则返回True,否则返回Falsle
+def aisincludeb(a,b):
+ result = a in b
+ print(result)
+ return result
+
+#删除字符串当前前几个,或后几个:sourcestr源串,a[2:-2] 表示去掉前面两个和后面两个,如果光去掉后面的a[:-2]
+def removeBeforOrAfter(sourcestr,a):
+ #a = "16541616584984"
+ #a = a[2:-2]
+ sourcestr = sourcestr[a]
+ return result
+
+#分离字符串
+def string2list(str,split):
+ return str.split(split)
+
+#用于生成一个指定范围内的整数
+def randomint(a,b):
+ return random.randint(a,b)
+
+#较小文件处理方法:
+def get_md5_01(file_path):
+ md5 = None
+ if os.path.isfile(file_path):
+ f = open(file_path,'rb')
+ md5_obj = hashlib.md5()
+ md5_obj.update(f.read())
+ hash_code = md5_obj.hexdigest()
+ f.close()
+ md5 = str(hash_code).lower()
+ return md5
+
+#较大文件处理方法:
+def get_md5_02(file_path):
+ f = open(file_path,'rb')
+ md5_obj = hashlib.md5()
+ while True:
+ d = f.read(8096)
+ if not d:
+ break
+ md5_obj.update(d)
+ hash_code = md5_obj.hexdigest()
+ f.close()
+ md5 = str(hash_code).lower()
+ return md5
\ No newline at end of file diff --git a/customlib/common/type_judgment.py b/customlib/common/type_judgment.py new file mode 100644 index 0000000..f3765ce --- /dev/null +++ b/customlib/common/type_judgment.py @@ -0,0 +1,4 @@ +
+def dataType(data):
+ type1=type(data)
+ return type1
diff --git a/customlib/common/util.py b/customlib/common/util.py new file mode 100644 index 0000000..98befec --- /dev/null +++ b/customlib/common/util.py @@ -0,0 +1,17 @@ +import socket
+import fcntl
+import struct
+import string
+
+def get_ip_address(ifname):
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ return socket.inet_ntoa(fcntl.ioctl(
+ s.fileno(),
+ 0x8915, # SIOCGIFADDR
+ struct.pack('256s', ifname[:15])
+ )[20:24])
+
+#get_ip_address('eth0') # '192.168.0.110'
+
+def source_str_is_cotain_destion_str(sourcestr,destionstr):
+ return string.find(sourcestr,destionstr)!=-1
\ No newline at end of file diff --git a/customlib/common_Run.py b/customlib/common_Run.py new file mode 100644 index 0000000..5aa4350 --- /dev/null +++ b/customlib/common_Run.py @@ -0,0 +1,228 @@ +# coding: utf-8
+
+import os,sys
+import time
+from config import BASE_PATH,Config
+from global_model.log import logger
+from global_model.format_change import formatChange
+from email_model.run_sendEmail import sendEailMock
+
+
+def batch_Call(basePath, product_item, testCase_tag):
+ '''
+ 首次执行测试:
+ param robot_testSuite: robot testSuite路径;
+ param product_item: 执行的待测产品项目;
+ param testCase_tag: 执行的测试用例标签;
+ param testCaseReportPath: 测试报告路径;
+ '''
+ try:
+ logger.info(u'=======================首次测试执行开始!正在初始化数据库!=============================')
+ pybot_result_list = []
+ output_dir = "-d " + basePath + "/Report/primo_report"
+ output_xml = "-o output.xml"
+ output_log = "-l log.html"
+ output_report = "-r report.html"
+ productItem = "-s " + product_item
+ caseTag = "-i " + testCase_tag
+ pybot_cmd = "pybot " + output_dir + " " + output_xml + " " + output_log + " " + output_report + " " + productItem + " " + caseTag + " " + basePath
+ pybot_result=os.system(pybot_cmd)
+ return pybot_result
+
+ except Exception as e:
+ logger.exception(u'首次执行测试失败. %s', e)
+
+ finally:
+ logger.info(u'测试项目根目录为:{0}'.format(basePath))
+ logger.debug(u'首次执行测试报告输出目录:{0}'.format(output_dir))
+ logger.info(u'首次执行测试的pybot命令:{0}'.format(pybot_cmd))
+ logger.info(u'======================首次执行测试已完成!用例失败数为:{0} 个!========================'.format(pybot_result))
+
+
+def mergeReport(basePath, report_title, match_report, copy_source_match, copy_target_match, merge_report_output):
+ '''
+ 合并报告:
+ param testCaseReportPath: 测试报告路径;
+ param report_title: 合并报告的标题;
+ return:
+ '''
+ try:
+ logger.info(u'==========================合并测试报告开始!==================================')
+ output_dir = "-d " + basePath + "/Report/{0}".format(merge_report_output) # 输出合并报告目录
+ output_xml = "-o output.xml"
+ output_log = "-l log.html"
+ output_report = "-r report.html"
+
+ # 被合并的报告
+ merge_report = "--merge " + basePath + "/Report/{0}".format(match_report) + "/output.xml"
+ title = "--ReportTitle " + report_title
+ rebot_cmd = r"rebot " + output_dir + " " + output_xml + " " + output_log + " " + output_report + " " + title + " " + merge_report
+ mergeReport_result = os.system(rebot_cmd)
+ logger.debug(u'合并报告的结果为:{0}'.format(mergeReport_result))
+
+ # 复制截图
+ testCaseReportPath = basePath + "/Report"
+ source_files = testCaseReportPath + "/{0}/*.png".format(copy_source_match)
+ target_dir = testCaseReportPath + "/{0}".format(copy_target_match)
+ cp_cmd = r"copy " + source_files + " " + target_dir
+ cp_cmd = cp_cmd.replace("/", "\\")
+ cope_result = os.system(cp_cmd)
+ logger.debug(u'复制截图的结果为:{0}'.format(cope_result))
+ return mergeReport_result
+
+ except Exception as e:
+ logger.exception(u'合并报告异常. %s', e)
+
+ finally:
+ logger.debug(u'输出合并报告目录为:{0}'.format(output_dir))
+ logger.info(u'合并报告rebot命令:{0}'.format(rebot_cmd))
+ if mergeReport_result != 0:
+ logger.info(u'======================合并报告中有失败用例!========================')
+ else:
+ logger.info(u'======================没有失败重试的报告需合并,或者合并报告中的用例已全通过!========================')
+ logger.info(u'复制截图命令为:{0}'.format(cp_cmd))
+ if cope_result == 0:
+ logger.info(u'======================截图已成功复制到合并报告中!========================')
+ else:
+ logger.info(u'======================报告中没有需要复制的截图!========================')
+
+
+def cleanLogs(basePath):
+ '''
+ 删除硬盘中合并前的测试报告:
+ param testCaseReportPath: 测试报告路径;
+ return:
+ '''
+ try:
+ logger.info(u'==========================清理磁盘报告开始!==================================')
+ testCaseReportPath = basePath + "/Report"
+ primo_report_files = testCaseReportPath + "/primo_report/*"
+ retry_report_files = testCaseReportPath + "/retry_report/*"
+ merge_files = testCaseReportPath + "/merge/*"
+ zip_merges_files = testCaseReportPath + "/zip_merges/*"
+ retry_times_files = testCaseReportPath + "/retry_times/*"
+ del_cmd = "del " + primo_report_files + " " + retry_report_files + " " + merge_files + " " + zip_merges_files + " " + retry_times_files
+ del_cmd = del_cmd.replace("/", "\\")
+ del_cmd = del_cmd + " " + "/s /q /f"
+ clean_result = os.system(del_cmd)
+
+ except Exception as e:
+ logger.exception(u'清理磁盘报告异常. %s', e)
+
+ finally:
+ logger.info(u'清理磁盘报告命令为:{0}'.format(del_cmd))
+ logger.debug(u'清理磁盘报告结果为:{0}'.format(clean_result))
+ if clean_result == 0:
+ logger.info(u'======================测试报告清理成功!========================')
+ else:
+ logger.info(u'======================测试报告清理失败!========================')
+
+
+def run_test(basePath, product_item, testCase_tag, report_title, email_switch, smtp_server, server_username, server_pwd, msg_to, msg_subject, retry_switch, retry_time):
+ '''
+ 失败自动重试:
+ param robot_testSuite: robot testSuite路径;
+ param testCase_tag: 执行的测试用例标签;
+ param testCaseReportPath: 测试报告路径;
+ param report_title: 合并报告的标题;
+ '''
+ #清理环境
+ cleanLogs(basePath)
+
+ #首次执行
+ run_result = batch_Call(basePath, product_item, testCase_tag)
+
+ #失败重试
+ retryFunction = retry_switch
+ if retryFunction == 1:
+ try:
+ if run_result != 0:
+ logger.info(u'======================失败用例重试第 1 次!========================')
+ output_dir = "-d " + basePath + "/Report/retry_report"
+ retry_xml = "-R " + basePath + "/Report/primo_report/output.xml"
+ pybot_cmd = "pybot " + retry_xml + " " + output_dir + " " + basePath
+ logger.info(u'第 1 次失败重试命令为:{0}'.format(pybot_cmd))
+ retry_result=os.system(pybot_cmd)
+ logger.info(u'======================失败用例重试第 1 次已完成!用例失败数为:{0} 个!========================'.format(retry_result))
+
+ retryTimes = retry_time
+ n = 2
+ while (retryTimes >=2 and retry_result != 0):
+ logger.info(u'======================失败用例重试第 {0} 次!========================'.format(n))
+ output_dir = "-d " + basePath + "/Report/retry_times"
+ retry_xml = "-R " + basePath + "/Report/retry_report/output.xml"
+ pybot_cmd = "pybot " + retry_xml + " " + output_dir + " " + basePath
+ logger.info(u'第 {0} 次失败重试命令为:{1}'.format(n, pybot_cmd))
+ retry_result=os.system(pybot_cmd)
+ logger.info(u'======================失败用例重试第 {0} 次已完成!用例失败数为:{1} 个!========================'.format(n, retry_result))
+
+ logger.info(u'======================正在合并重试报告!========================')
+ merge_report_output = 'retry_report'
+ match_report = 'retry_*'
+ copy_source_match = 'retry_times'
+ copy_target_match = 'retry_report'
+ mergeReport(basePath, report_title, match_report, copy_source_match, copy_target_match, merge_report_output)
+ logger.info(u'======================失败用例重试第 {0} 次合并报告已完成!========================'.format(n))
+ n = n + 1
+ retryTimes = retryTimes-1
+
+ except Exception as e:
+ logger.exception(u'失败重试异常. %s', e)
+
+ else:
+ logger.info(u'======================本次测试的失败重试功能已关闭!========================')
+
+ #合并报告
+ merge_report_output = 'merge'
+ match_report = '*_report'
+ copy_source_match = 'retry_report'
+ copy_target_match = 'merge'
+ report_result = mergeReport(basePath, report_title, match_report, copy_source_match, copy_target_match, merge_report_output)
+ logger.debug(u'======================最终测试结果为: {0} !========================'.format(report_result))
+ if report_result == 0:
+ ReportResult = u'测试通过!'
+ else:
+ ReportResult = u'测试不通过!失败用例数为:{0} 个'.format(report_result)
+
+ #发送report到邮件
+ emailFunction = email_switch
+ if emailFunction == 1:
+
+ #将字符中的反斜杠转成正斜杠
+ fileUrl_PATH = basePath.replace('\\','/')
+ logger.debug(u'基础路径的反斜杠转成正斜杠为:{0}'.format(fileUrl_PATH))
+
+ fileUrl='file:///{0}/Report/merge/report.html'.format(fileUrl_PATH)
+ logger.info(u'html测试报告的url为:{0}'.format(fileUrl))
+ save_fn=r'{0}\Report\zip_merges\report.png'.format(basePath)
+ logger.debug(u'转成图片报告后保存的目标路径为:{0}'.format(save_fn))
+ formatChange_obj = formatChange()
+ formatChange_obj.html_to_image(fileUrl, save_fn)
+
+ email_folder_dir = basePath + "/Report/merge" #待压缩文件夹
+ logger.debug(u'待压缩文件夹为:{0}'.format(email_folder_dir))
+ email_target_dir = basePath + "/Report/zip_merges" #压缩文件保存路径
+ sendEailMock_obj = sendEailMock()
+ sendEailMock_obj.send_email(email_folder_dir, email_target_dir, smtp_server, server_username, server_pwd, msg_to, msg_subject, ReportResult, save_fn)
+ else:
+ logger.info(u'======================本次测试的邮件功能已关闭!========================')
+
+
+if __name__ == '__main__':
+
+ c = Config()
+ ProductItem = c.get('ProductItem')
+ testSuite = c.get('testSuite')
+ testReportTitle = c.get('testReportTitle')
+
+ emailSwitch = c.get('emailSwitch')
+ smtp_server = c.get('smtp_server')
+ server_username = c.get('server_username')
+ server_pwd = c.get('server_pwd')
+ msg_to = c.get('msg_to')
+ msg_subject = c.get('msg_subject')
+
+ retrySwitch = c.get('retry_switch')
+ retryTime = c.get('retryTime')
+
+ run_test(BASE_PATH, ProductItem, testSuite, testReportTitle, emailSwitch, smtp_server, server_username, server_pwd, msg_to, msg_subject, retrySwitch, retryTime)
\ No newline at end of file diff --git a/keyword/common/login_logout.robot b/keyword/common/login_logout.robot new file mode 100644 index 0000000..e19cf80 --- /dev/null +++ b/keyword/common/login_logout.robot @@ -0,0 +1,80 @@ +*** Settings ***
+Library Selenium2Library
+Resource ../../variable/common_variable.txt
+
+*** Keywords ***
+
+Login
+ Open Browser http://${host}/#/login ${browserType}
+ Maximize Browser Window
+ ClearCache
+ input text id=usernameInput ${username}
+ input text name=password ${password}
+ Click button id=login
+ PasswordPrompt #判断是否有密码过期的提示
+
+ClearCache
+ ${status} Run Keyword And Return Status Page Should Contain After update the version, you need to clear the cache and log in again, otherwise some functions will not be available. #判断页面是否包含该文本
+ run keyword if "${status}"=="True" click element xpath=/html/body/div[2]/div/div[3]/button[2]
+ run keyword if "${status}"=="False" log 不用进行清除缓存
+
+PasswordPrompt
+ [Arguments] ${passwd}=null ${day}=100 ${editpasswd}=no
+ sleep ${sleep}
+ Page Should Contain Dashboard
+
+PasswordPromptTrue
+ [Arguments] ${passwd} ${day} ${editpasswd}
+ run keyword if "${editpasswd}"=="yes" run keywords sleep 1
+ ... AND click element xpath=/html/body/div[2]/div/div[3]/button[2]
+ ... AND sleep 1
+ ... AND ChangePassword ${passwd} ${day}
+ ... ELSE IF "${editpasswd}"=="no" run keywords sleep 1
+ ... AND click element xpath=/html/body/div[2]/div/div[3]/button[1]
+ ... AND sleep 1
+
+ChangePassword
+ [Arguments] ${passwd} ${day} ${Required-Password-Change}=close
+ #判断是否修改密码
+ run keyword if "${passwd}"!="null" Run Keywords sleep 1
+ ... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[3]/div/div/input ${passwd}
+ ... AND sleep 1
+ ... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[4]/div/div/input ${passwd}
+ ... AND sleep 1
+ ${class}= Get Element Attribute xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[5]/div/div class #获取Required-Password-Change按钮的class元素的值
+ #通过元素的值判断按钮是开启状态还是关闭状态
+ run keyword if "${Required-Password-Change}"=="open" and "${class}"=="el-switch is-checked" Run Keywords log 按钮为开启状态,不进行操作
+ ... AND sleep 1
+ ... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day}
+ ... AND sleep 1
+ run keyword if "${Required-Password-Change}"=="open" and "${class}"=="el-switch" Run Keywords log 按钮为关闭状态,需要点击开启
+ ... AND sleep 1
+ ... AND input text xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[6]/div/div/input ${day}
+ ... AND sleep 1
+ run keyword if "${Required-Password-Change}"=="close" and "${class}"=="el-switch is-checked" Run Keywords log 按钮为开启状态,需要点击关闭
+ ... AND sleep 1
+ ... AND click element xpath=xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[1]/div[2]/form/div[5]/div/div
+ run keyword if "${Required-Password-Change}"=="close" and "${class}"=="el-switch" log 按钮为关闭状态,不进行操作
+ sleep 1
+ click element xpath=//*[@id="app"]/div/div[3]/div[1]/div/div/div[1]/div/div/div[1]/div/div/div[2]/button[1]
+
+Logout
+ #Mouse Hover xpath=//*[@id="app"]/div/div[1]/div[2]/div/span/div/span
+ #/html/body/div[1]/div/div[1]/div[2]/div/span[2]/div/span
+ Mouse Over xpath=//*[@id="app"]/div/div[2]/div[1]/div[4]/div[2]/div
+ sleep 0.5
+ click element id=header-to-logout
+ sleep 2
+ Close All Browsers
+
+UiLoginAndAddLocalIP
+ log UiLoginAndAddLocalIP
+ Login
+ # Run Keyword If ${addTestClentIPFlag}==1 AddLocalIp
+ log UiLoginAndAddLocalIP:${LocahIPName}
+
+
+UiLogoutAndDelLocalIP
+ log UiLogoutAndDelLocalIP
+ # Run Keyword If ${addTestClentIPFlag}==1 DeletePage ${LocahIPName}
+ Logout
\ No newline at end of file diff --git a/keyword/common/login_logout_switch.robot b/keyword/common/login_logout_switch.robot new file mode 100644 index 0000000..5e6c82a --- /dev/null +++ b/keyword/common/login_logout_switch.robot @@ -0,0 +1,22 @@ +*** Settings ***
+Resource ../../variable/common_variable.txt
+Library Collections
+Resource login_logout.robot
+#Resource logout.robot
+#Resource login.robot
+
+
+*** Keywords ***
+LoginAndAddLocalIP
+ [Tags] tsg_adc tsg_bf_api tsg_device tsg_adc_wp adc_api adc_verify adc_log
+ #[Tags] 分步骤之外的全流程 毕方接口 设备相关 分步骤全部 分步骤策略 分步骤功能端验证 分步骤日志验证
+ # 获取主机IP
+ #${ip} Get Host IP
+ #Run Keyword If '${ip}' != '${EMPTY}' Set Global Variable ${testClentIP} ${ip}
+
+ Run Keyword If '${loginType}' == 'ui' UiLoginAndAddLocalIP
+
+
+LogoutAndDelLocalIP
+ [Tags] tsg_adc tsg_bf_api tsg_device tsg_adc_wp adc_api adc_verify adc_log
+ Run Keyword If '${loginType}' == 'ui' UiLogoutAndDelLocalIP
diff --git a/keyword/common/page.robot b/keyword/common/page.robot new file mode 100644 index 0000000..0d745ff --- /dev/null +++ b/keyword/common/page.robot @@ -0,0 +1,569 @@ +*** Settings ***
+Library yaml
+Library OperatingSystem
+Library Selenium2Library
+Library Collections
+Library String
+Resource ../../variable/common_variable.txt
+Library ../../customlib/common/type_judgment.py
+
+*** Keywords ***
+YamlLoad
+ [Arguments] ${filepath}
+ [Documentation] 读取yaml文件
+ ... ${filepath}:文件路径
+ ${yaml}= Get File ${filepath}
+ ${loaded}= yaml.Safe Load ${yaml}
+ [Return] ${loaded}
+
+CreateOrEditPage
+ [Arguments] ${elementList} ${dataList} ${openCreateOrEditPage} ${okOrCance}
+ [Documentation] 完整的打开创建或者修改数据页面,并进行操作(创建数据、修改数据)
+ ... ${elementList}:模板的PageData数据,格式:[{id=responsepages_profileName1,value=testname}]
+ ... ${dataList}:数据文件中的数据,格式[[id=responsepages_profileName1,value=testname]]
+ ... ${openCreateOrEditPage}:模板文件中openCreateOrEditPage数据
+ ... ${okOrCance}:模板文件中okOrCancel的数据
+ #判断是否出现弹出框
+ ${operatingType} Set Variable ${1}
+ FOR ${data} IN @{dataList}
+ ${operatingType} Get From Dictionary ${data} operatingType
+ Run keyword if "${operatingType}" == "create" or "${operatingType}" == "edit" or "${operatingType}" == "createGroup" run keywords log 执行用例
+ ... AND OperatPage ${elementList} ${data} ${openCreateOrEditPage}
+ ... AND OkOrCancel ${okOrCance} ${data}
+ END
+ ${deletePosition} Get From Dictionary ${okOrCance} delete
+ Run keyword if "${operatingType}" == "create" or "${operatingType}" == "edit" or "${operatingType}" == "createGroup" run keywords log 执行用例
+ ... AND DeleteData ${deletePosition}
+
+OperatPage
+ [Arguments] ${elementList} ${pData} ${openCreateOrEditPage}=1
+ [Documentation] 打开创建或者修改数据页面,输入数据
+ ... ${elementList}:模板的PageData数据,格式:[{id=responsepages_profileName1,value=testname}]
+ ... ${pData}:数据文件中的数据,格式[id=responsepages_profileName1,value=testname]
+ ... ${openCreateOrEditPage}:模板文件中openCreateOrEditPage数据
+ ${dataType} Evaluate type(${openCreateOrEditPage})
+ ${openType} Run keyword if "${dataType}" == "<class 'dict'>" Get From Dictionary ${pData} operatingType
+ Run keyword if "${dataType}" == "<class 'dict'>" run keywords log 打开创建页面
+ ... AND OpenCreateOREdit ${openCreateOrEditPage}[${openType}]
+ FOR ${element} IN @{elementList}
+ ${type} Get From Dictionary ${element} type
+ ${return} ${elementId} Run Keyword And Ignore Error Get From Dictionary ${element} position
+ ${elementId} Run Keyword If "${return}"=="FAIL" set variable null
+ ... ELSE set variable ${elementId}
+ ${value} Get From Dictionary ${element} value
+ ${return} ${elementValue} Run Keyword And Ignore Error Get From Dictionary ${pData} ${value}
+ ${elementValue} Run Keyword If "${return}"=="FAIL" set variable null
+ ... ELSE set variable ${elementValue}
+ ${return} ${elementData} Run Keyword And Ignore Error Get From Dictionary ${element} data
+ ${elementData} Run Keyword If "${return}"=="FAIL" set variable null
+ ... ELSE set variable ${elementData}
+ ${return} ${default} Run Keyword And Ignore Error Get From Dictionary ${element} default
+ ${default} Run Keyword If "${return}"=="FAIL" or "${default}"=="${EMPTY}" set variable null
+ ... ELSE set variable ${default}
+ Run Keyword IF "${elementValue}" != "null" run keywords log 执行操作
+ ... AND Operation ${type} ${elementId} ${elementValue} ${elementData} ${default}
+ END
+
+OpenCreateOREdit
+ [Arguments] ${menuIdList}
+ [Documentation] 点击新增或修改按钮
+ ... ${menuIdList}:打开目标界面需要点击的所有按钮,顺序输入
+
+ FOR ${menuId} IN @{menuIdList}
+ sleep ${sleep}
+ #Wait Until Element Is Enabled id=${menuId} ${sleep_Wait}
+ click element ${menuId}
+ END
+ sleep ${sleep}
+
+Operation
+ [Arguments] ${type} ${positioning} ${dataValue}=null ${elementData}=null ${default}=null
+ [Documentation] 根据type进行操作
+ ... ${type}:操作类型
+ ... ${positioning}:操作的元素定位信息
+ ... ${dataValue}:输入、或者上传的数据信息
+ ... ${elementData} : 模板中的PageData中的data数据,当数据为嵌套数据时有该字段
+
+ Run Keyword If "${type}" == "input" input text ${positioning} ${dataValue}
+ ... ELSE IF "${type}" == "upload" Choose File ${positioning} ${path}data/scriptfile/${dataValue}
+ ... ELSE IF "${type}" == "combination" run keywords log 嵌套操作
+ ... AND OperatCombinationData ${dataValue} ${elementData} ${positioning}
+ ... ELSE IF "${type}" == "combinationAfter" run keywords log 嵌套操作第二种
+ ... AND OperatCombinationData2 ${dataValue} ${elementData} ${positioning}
+ ... ELSE IF "${type}" == "click" run keywords log 点击按钮
+ ... AND click element ${positioning}
+ ... AND sleep ${sleep}
+ ... ELSE IF "${type}" == "clickTexts" run keywords log 点击多个文本
+ ... AND ClickTexts ${dataValue}
+ ... ELSE IF "${type}" == "clickText" run keywords log 点击单个文本
+ ... AND ClickText ${dataValue}
+ ... ELSE IF "${type}" == "columnSetup" run keywords log 点击列设置中取消列选中
+ ... AND CancelColumnSetup ${dataValue}
+ ... ELSE IF "${type}" == "switch" run keywords log 开关按钮
+ ... AND SwitchButton ${positioning} ${dataValue} ${default}
+ ... ELSE IF "${type}" == "switchCombination" run keywords log 开关按钮,关闭或打开时进行操作
+ ... AND SwitchCombination ${positioning} ${dataValue} ${default} ${elementData}
+ ... ELSE IF "${type}" == "radioButton" run keywords log 单选按钮
+ ... AND RadioButton ${dataValue} ${elementData}
+ ... ELSE IF "${type}" == "search" run keywords log 单条查询点击定位位置
+ ... AND SearchOperation ${positioning} ${dataValue}
+ ... ELSE IF "${type}" == "searchClickText" run keywords log 单条查询点击文本
+ ... AND SearchOperationClickText ${positioning} ${dataValue}
+ ... ELSE IF "${type}" == "searchs" run keywords log 查询多数据后点击文本
+ ... AND SearchOperations ${positioning} ${dataValue}
+ ... ELSE IF "${type}" == "assert" run keywords log 断言
+ ... AND PageAssert ${positioning} ${dataValue}
+ ... ELSE log 无法识别的类型
+ sleep ${sleep}
+
+OperatCombinationData
+ [Arguments] ${elementValue} ${templateData} ${positioning}
+ [Documentation] 多步骤嵌套动作方法,循环取出数据
+ ... ${elementValue}:数据文件中嵌套操作数据
+ ... ${templateData}:模板文件中嵌套数据data数据
+
+ FOR ${element} IN @{elementValue}
+ sleep ${sleep}
+ click element ${positioning}
+ sleep ${sleep}
+ ${elementList} create list ${element}
+ OperatCombination ${elementList} ${templateData}
+ END
+
+OperatCombinationData2
+ [Arguments] ${elementValue} ${templateData} ${positioning}
+ [Documentation] 多步骤嵌套动作方法,循环取出数据。
+ ... ${elementValue}:数据文件中嵌套操作数据
+ ... ${templateData}:模板文件中嵌套数据data数据
+ ${sum} Set Variable ${0}
+ FOR ${element} IN @{elementValue}
+ run keyword if "${sum}" != "0" run keywords log 第二次循环开始执行
+ ... AND click element ${positioning}
+ ... AND sleep ${sleep}
+ ${elementList} create list ${element}
+ OperatCombination ${elementList} ${templateData}
+ ${sum} Evaluate ${sum}+${1}
+ END
+
+OperatCombination
+ [Arguments] ${elementValue} ${templateData}
+ [Documentation] 多步骤嵌套动作方法,递归执行该方法
+ ... ${elementValue}:数据文件中嵌套操作数据
+ ... ${templateData}:模板文件中嵌套数据data数据
+ ${dataValue} Set variable
+ ${dataValueKey} Set variable
+ FOR ${element} IN @{elementValue}
+ log ${element}
+ ${dataType} dataType ${element}
+ ${dataValue} Run keyword if "${dataType}" == "<class 'dict'>" get dictionary keys ${element}
+ log ${dataValue}
+ ${dataValueKey} Run keyword if "${dataType}" == "<class 'dict'>" Set variable ${dataValue}[0]
+ ... ELSE Set Variable ${element}
+ log ${dataValueKey}
+ ${re} CombinationLate ${templateData} ${dataValueKey}
+ ${type} Get From Dictionary ${re} type
+ ${return} ${elementId} Run Keyword And Ignore Error Get From Dictionary ${re} position
+ ${elementId} Run Keyword If "${return}"=="FAIL" set variable null
+ ... ELSE set variable ${elementId}
+ ${data} Get From Dictionary ${re} data
+ log ${dataType}
+ ${value} Run keyword if "${dataType}" == "<class 'dict'>" Get From Dictionary ${element} ${dataValueKey}
+ ... ELSE IF "${dataType}" == "<class 'str'>" Set Variable null
+ ... ELSE log 非类型
+ log ${value}
+ # ${value} Get From Dictionary ${element} ${dataValueKey}
+ ${return} ${default} Run Keyword And Ignore Error Get From Dictionary ${re} default
+ ${default} Run Keyword If "${return}"=="FAIL" or "${default}"=="${EMPTY}" set variable null
+ ... ELSE set variable ${default}
+ Run keyword if "${value}" == "None" log 无数据不操作
+ ... ELSE Operation ${type} ${elementId} ${value} ${data} default=${default}
+ ${listType} dataType ${value}
+ log ${listType}
+ Run keyword if "${listType}" != "<class 'str'>" and "${type}" != "combination" and "${type}" != "combinationAfter" and "${listType}" != "<class 'NoneType'>" OperatCombination ${value} ${data}
+ END
+
+CombinationLate
+ [Arguments] ${elementData} ${dataValue}
+ [Documentation] 多步骤嵌套动作对比循环取出模板文件的value同数据文件中的值进行对比,并返回对比成功的key值
+ log ${dataValue}
+ ${re} Set variable
+ FOR ${i} IN @{elementData}
+ log ${i}[value]
+ ${re} Run keyword if "${i}[value]" == "${dataValue}" Set variable ${i}
+ ... ELSE Set variable ${re}
+ END
+ log ${re}
+ [Return] ${re}
+
+SwitchButton
+ [Arguments] ${positioning} ${dataStatus} ${default}
+ [Documentation] 单选按钮操作
+ ... ${positioning}:单选按钮定位信息
+ ... ${dataStatus}:数据中按钮的状态
+ ... ${default}:模板中按钮的默认状态
+ Run Keyword If "${dataStatus}" == "${default}" log 状态相同不进行操作
+ ... ELSE click element ${positioning}
+
+SwitchCombination
+ [Arguments] ${positioning} ${pageData} ${default} ${elementData}
+ [Documentation] 开关按钮组合操作,关闭或打开时进行下一步操作
+ ... ${positioning}: 开关按钮定位信息
+ ... ${pageData}:数据中按钮的状态
+ ... ${default}:模板中按钮的默认状态
+ ... ${elementData}:模板中的PageData中的data数据,按钮状态改变进行下一步操作
+ log ${positioning}
+ log ${pageData}
+ log ${default}
+ log ${elementData}
+ ${dataType} dataType ${pageData}
+ ${dataValue} Run keyword if "${dataType}" == "<class 'dict'>" get dictionary keys ${pageData}
+ log ${dataValue}
+ ${dataValueKey} Set Variable if "${dataType}" == "<class 'dict'>" ${dataValue}[0]
+ ... ${pageData}
+ ${data} Run keyword if "${dataType}" == "<class 'dict'>" Set variable ${pageData}[${dataValueKey}]
+ Run Keyword If "${dataValueKey}" == "${default}" log 状态相同不进行操作
+ ... ELSE SwitchCombinationOperation ${positioning} ${elementData} ${data}
+
+SwitchCombinationOperation
+ [Arguments] ${positioning} ${elementData} ${datas}
+ [Documentation] 根据开关状态进行下一步操作
+ ... ${positioning}:开关按钮定位信息
+ ... ${elementData}:模板中的PageData中的data数据,按钮状态改变进行下一步操作
+ ... ${datas} :数据文件中的操作数据
+ click element ${positioning}
+ sleep ${sleep}
+ FOR ${data} IN @{datas}
+ ${dataKey} get dictionary keys ${data}
+ log ${dataKey}
+ ${template} CombinationLate ${elementData} ${dataKey}[0]
+ ${type} Get From Dictionary ${template} type
+ ${elementId} Get From Dictionary ${template} position
+ ${templateData} Get From Dictionary ${template} data
+ ${value} Get From Dictionary ${template} value
+ ${dataValue} Get From Dictionary ${data} ${value}
+ Operation ${type} ${elementId} ${dataValue} ${templateData}
+ END
+
+RadioButton
+ [Arguments] ${dataValue} ${elementData}
+ [Documentation] 单选按钮操作
+ ... ${dataValue}:数据文件中单选按钮的名称
+ ... ${elementData}:模板中所有单选按钮的数据
+ FOR ${button} IN @{elementData}
+ ${type} Get From Dictionary ${button} type
+ ${position} Get From Dictionary ${button} position
+ ${value} Get From Dictionary ${button} value
+ Run Keyword If "${dataValue}" == "${value}" run keywords log 点击${value}按钮
+ ... AND Operation ${type} ${position}
+ END
+
+ClickTexts
+ [Arguments] ${positioning}
+ [Documentation] 根据文本定位,点击页面中多个文本
+ ... ${positioning}:文本列表
+ FOR ${i} IN @{positioning}
+ click element //span[contains(text(),'${i}')]
+ sleep ${sleep}
+ END
+
+ClickText
+ [Arguments] ${positioning}
+ [Documentation] 根据文本定位,点击页面中多个文本
+ ... ${positioning}:文本列表
+ click element //span[contains(text(),'${positioning}')]
+ sleep ${sleep}
+
+SearchOperation
+ [Arguments] ${positioning} ${searchData}
+ [Documentation] 页面查询操作
+ ... ${positioning}:查询输入框定位
+ ... ${searchData}:查询内容
+ sleep ${sleep}
+ input text ${positioning}[0] ${searchData}
+ sleep ${sleep}
+ press keys ${positioning}[0] ENTER
+ sleep ${sleep}
+ click element ${positioning}[1]
+ sleep ${sleep}
+
+SearchOperationClickText
+ [Arguments] ${positioning} ${searchData}
+ [Documentation] 页面查询操作
+ ... ${positioning}:查询输入框定位
+ ... ${searchData}:查询内容
+ sleep ${sleep}
+ input text ${positioning} ${searchData}
+ sleep ${sleep}
+ press keys ${positioning} ENTER
+ sleep ${sleep}
+ click element //span[contains(text(),'${searchData}')]
+ sleep ${sleep}
+
+SearchOperations
+ [Arguments] ${positioning} ${searchData}
+ [Documentation] 页面查询多数据操作
+ ... ${positioning}:查询输入框定位
+ ... ${searchData}:查询内容
+ sleep ${sleep}
+ FOR ${i} IN @{searchData}
+ input text ${positioning}[0] ${i}
+ sleep ${sleep_min}
+ press keys ${positioning}[0] ENTER
+ sleep ${sleep}
+ click element //span[contains(text(),'${i}')]
+ sleep ${sleep}
+ END
+
+PageAssert
+ [Arguments] ${positioning} ${assertText}
+ [Documentation] 页面查询多数据操作
+ ... ${positioning}: 断言定位
+ ... ${assertText}: 断言文本
+ ${text} Get Text ${positioning}
+ Should Be Equal As Strings ${text} ${assertText}
+
+OkOrCancel
+ [Arguments] ${templateData} ${data}
+ [Documentation] 提交数据后校验
+ ... ${templateData}: 模板文件中okOrCancel数据,用于点击ok按钮及创建成功校验
+ ... ${data}:数据文件内容
+ ${okBUutton} Get From Dictionary ${templateData} position
+ ${assertPosition} Get From Dictionary ${templateData} ${data}[searchCriteria]
+ ${searchCriteria} Get From Dictionary ${data} searchCriteria
+ click element ${okBUutton} #点击OK缇交
+ sleep ${sleep}
+ SearchData ${data}[${searchCriteria}] ${templateData} ${searchCriteria} #搜索框的关键字
+ click element ${templateData}[Selected]
+ ${text1} Get Text ${assertPosition} #获取点击后页面文本信息
+ Should Be Equal As Strings ${text1} ${data}[${searchCriteria}]
+
+SearchData
+ [Arguments] ${value} ${templateData} ${searchCriteria}
+ [Documentation]
+ ... ${value}:传入查询的数据
+ ... ${templateData}:模板中okOrCancel得数据
+ ... ${searchCriteria}:搜索条件
+ ${searchType} Get From Dictionary ${templateData} search
+ Run Keyword If "${searchType}" == "type1" run keywords log 第一种搜索
+ ... AND SearchType1 ${value} ${searchCriteria}
+
+CancelColumnSetup
+ [Arguments] ${columns}
+ FOR ${i} IN @{columns}
+ click element xpath=/html/body/div[1]/div/div[2]/div[2]/div/div/div/div[3]/div[2]/div/div/span[contains(text(),'${i}')]
+ sleep ${sleep}
+ END
+
+SearchType1
+ [Arguments] ${searchvalue} ${searchCriteria}
+ [Documentation] 本方法搜索查询适用于User
+ ... ${searchvalue}:搜索条件的值
+ ... ${search}:搜索条件
+ ... ${templateData}:模板中okOrCancel得数据
+ sleep ${sleep}
+ click element id=one-input #点击搜索框
+ sleep ${sleep_min}
+ click element xpath=//*[@id="input_list"]/ul/li/span[contains(text(), "${searchCriteria}")]
+ input text id=sreach_input ${searchValue}
+ sleep ${sleep}
+ click element id=search-input-search #点击搜索按钮
+ sleep ${sleep}
+ click element xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[2]/div[1]/div[2]/div[1]/div/div/div[3]/i
+ sleep ${sleep}
+
+DeleteData
+ [Arguments] ${position}
+ [Documentation] 删除测试数据
+ ... ${position}:删除按钮元素定位
+ sleep ${sleep}
+ click element ${position}
+ sleep ${sleep}
+ click element xpath=/html/body/div/div/div[3]/button[2]
+ sleep ${sleep}
+
+CreateOrEditPageNegtive
+ [Arguments] ${elementList} ${dataList} ${OpenCreateOrEditPage} ${OkOrCance}
+ [Documentation] 完整的打开创建页面反向用例关键字
+ ... ${elementList}:模板的PageData数据,格式:[{id=responsepages_profileName1,value=testname}]
+ ... ${dataList}:数据文件中的数据,格式[[id=responsepages_profileName1,value=testname]]
+ ... ${OpenCreateOrEditPage}:模板文件中OpenCreateOrEditPage数据
+ ... ${OkOrCance}:模板文件中OkOrCancel的数据
+
+ FOR ${data} IN @{dataList}
+ #打开页面输入数据
+ OperatPageNegtive ${elementList} ${data} ${OpenCreateOrEditPage}
+ # 点击OK按钮
+ OkButton ${OkOrCance}
+ # 页面断言
+ AssertPage ${data}[assertText]
+ END
+
+OperatPageNegtive
+ [Arguments] ${elementList} ${pData} ${OpenCreateOrEditPage}
+ [Documentation] 打开创建或者修改数据页面,输入数据
+ ... ${elementList}:模板的PageData数据,格式:[{id=responsepages_profileName1,value=testname}]
+ ... ${pData}:数据文件中的数据,格式[id=responsepages_profileName1,value=testname]
+ ... ${OpenCreateOrEditPage}:模板文件中OpenCreateOrEditPage数据
+
+ ${openType} Get From Dictionary ${pData} operatingType
+ OpenCreateOREdit ${OpenCreateOrEditPage}[${openType}]
+ ${dataType} Run keyword if "${openType}" == "create" or "${openType}" == "edit" Set Variable createAndEdit
+ ... ELSE IF "${openType}" == "createGroup" or "${openType}" == "editGroup" Set Variable createAndEditGroup
+ ${elementList} Set Variable ${elementList}[${dataType}]
+ FOR ${element} IN @{elementList}
+ ${type} Get From Dictionary ${element} type
+ ${return} ${elementId} Run Keyword And Ignore Error Get From Dictionary ${element} position
+ ${elementId} Run Keyword If "${return}"=="FAIL" set variable null
+ ... ELSE set variable ${elementId}
+ ${value} Get From Dictionary ${element} value
+ ${return} ${elementValue} Run Keyword And Ignore Error Get From Dictionary ${pData} ${value}
+ ${elementValue} Run Keyword If "${return}"=="FAIL" set variable null
+ ... ELSE set variable ${elementValue}
+ ${return} ${elementData} Run Keyword And Ignore Error Get From Dictionary ${element} data
+ ${elementData} Run Keyword If "${return}"=="FAIL" set variable null
+ ... ELSE set variable ${elementData}
+ ${return} ${default} Run Keyword And Ignore Error Get From Dictionary ${element} default
+ ${default} Run Keyword If "${return}"=="FAIL" or "${default}"=="${EMPTY}" set variable null
+ ... ELSE set variable ${default}
+ Run Keyword If "${elementValue}" != "null" run keywords log 进行操作
+ ... AND Operation ${type} ${elementId} ${elementValue} ${elementData} ${default}
+ END
+
+OkButton
+ [Arguments] ${OkOrCance}
+ [Documentation] 点击Ok按钮
+ ... ${OkOrCance}:模板文件中OkOrCancel的数据
+ ${okPosition} Get From Dictionary ${OkOrCance} position
+ sleep ${sleep}
+ click element ${okPosition}
+ sleep ${sleep_min}
+
+AssertPage
+ [Arguments] ${assertText}
+ [Documentation] 反向用例断言
+ ... ${assertText}: 断言数据列表形式["assertText1","assertText2"]
+ FOR ${text} IN @{assertText}
+ Page Should Contain ${text}
+ END
+
+TextContain
+ [Arguments] ${columnList} ${text}
+ [Documentation] 验证页面不存在文本关键字
+ FOR ${column} IN @{columnList}
+ should not be equal ${column} ${text}
+ END
+
+CreatePageTextAssert
+ [Arguments] ${elementList} ${dataList} ${OpenCreateOrEditPage}
+ [Documentation] 用于创建页面内文本断言
+ ... ${elementList}:模板的PageData数据,格式:[{id=responsepages_profileName1,value=testname}]
+ ... ${dataList}:数据文件中的数据,格式[id=responsepages_profileName1,value=testname]
+ ... ${OpenCreateOrEditPage}:模板文件中OpenCreateOrEditPage数据
+ #打开页面输入数据
+ OperatPageNegtive ${elementList} ${dataList} ${OpenCreateOrEditPage}
+ #数据文件中断言列表
+ ${texts} Get From Dictionary ${dataList} AssertText
+ # 页面文本断言
+ FOR ${text} IN @{texts}
+ Page Should Contain ${text}
+ END
+
+PrioritySelectCaseData
+ [Arguments] ${objDataList}
+ #增加优先级筛选执行代码,当operatingtype中最后一位值为9时,只执行该数据参数
+ ${templist} create list
+ log to console 获取的原始数据------${objDataList}
+ FOR ${it} IN @{objDataList}
+ ${operatingType0} Get From Dictionary ${it}[0] operatingType
+ ${operatingType} get substring ${operatingType0} -1
+ ${operatingType1} get substring ${operatingType0} 0 -1
+ Run keyword if "${operatingType}" == "9" run keywords
+ ... set to dictionary ${it}[0] operatingType ${operatingType1}
+ ... AND append to list ${templist} ${it}
+ ... AND log to console ${templist}
+ END
+ ${templistcount} get length ${templist}
+
+ ${objDataList} run keyword if ${templistcount}>0 set variable ${templist}
+ ... ELSE set variable ${objDataList}
+ log to console 优先执行的数据------${objDataList}
+ [Return] ${objDataList}
+ #优先级筛选执行结束
+OpenPage
+ [Arguments] ${openCreateOrEditPage}
+ [Documentation] 打开测试页面
+ ${pagePosition} Get From Dictionary ${openCreateOrEditPage} create
+ ${pagePosition} get substring ${pagePosition} 0 2
+ FOR ${i} IN @{pagePosition}
+ click element ${i}
+ sleep ${sleep}
+ END
+
+TestPageVerifyOperation
+ [Arguments] ${openCreateOrEditPage} ${data} ${tempData}
+ [Documentation] 测试页面操作验证
+ ... ${openCreateOrEditPage}:模板文件中openCreateOrEditPage中数据,打开页面定位信息
+ #登录后打开测试页面
+ OpenPage ${openCreateOrEditPage}
+ OperatPage ${tempData} ${data}
+
+
+ColumnSetup
+ [Arguments] ${openCreateOrEditPage} ${data} ${tempData}
+ [Documentation] 列设置验证关键字
+ ... ${openCreateOrEditPage}:模板文件中openCreateOrEditPage中数据,打开页面定位信息
+ #登录后打开测试页面
+ OpenPage ${openCreateOrEditPage}
+ OperatPage ${tempData} ${data}
+ # 断言页面不存在列
+ ${columnList} Get From Dictionary ${data} cancel_show
+ ${assertPosition} Get From Dictionary ${data} assertPosition
+ FOR ${position} IN @{assertPosition}
+ ${text} Get text ${position}
+ TextContain ${columnList} ${text}
+ END
+
+TurnPage
+ [Arguments] ${openCreateOrEditPage} ${okOrCancel}
+ [Documentation] 翻页功能
+
+ OpenPage ${openCreateOrEditPage}
+ ${number} Get Text xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[2]/div[3]/div/div/span
+ log ${number}
+ ${number} get substring ${number} 6
+ log ${number}
+ Run keyword if ${number} > 20 Run keywords log 执行翻页操作
+ ... AND TurnPageAssert ${okOrCancel}
+
+TurnPageAssert
+ [Arguments] ${okOrCancel}
+ [Documentation] 验证翻页功能
+ ${idPosition} Get From Dictionary ${okOrCancel} ID
+ ${id1} Get Text ${idPosition}
+ click element xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div/div[2]/div[3]/div/div/button[2]
+ sleep ${sleep}
+ ${id2} Get Text ${idPosition}
+ click element xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div/div[2]/div[3]/div/div/button[1]
+ sleep ${sleep}
+ ${id3} Get Text ${idPosition}
+ click element xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div[1]/div/div[2]/div[3]/div/div/ul/li[2]
+ sleep ${sleep}
+ ${id4} Get Text ${idPosition}
+ Should Not Be Equal ${id1} ${id2}
+ Should Not Be Equal ${id2} ${id3}
+ Should Not Be Equal ${id3} ${id4}
+
+
+
+
+UserOperationLog
+ [Arguments] ${openCreateOrEditPage}
+ [Documentation] 验证user页面账号日志功能
+
+ OpenPage ${openCreateOrEditPage}
+ SearchType1 ${username} User
+ click element xpath=//*[@id="userTable"]/div[4]/div[2]/table/tbody/tr/td[11]/div/div/button
+ sleep ${sleep}
+ ${text} Get Text xpath=//*[@id="roleTable"]/div[3]/table/tbody/tr[1]/td[4]/div/span
+ Should Be Equal As Strings ${text} ${testClentIP}
+
diff --git a/other/data/administration/user_data.yaml b/other/data/administration/user_data.yaml new file mode 100644 index 0000000..98b6f6a --- /dev/null +++ b/other/data/administration/user_data.yaml @@ -0,0 +1,31 @@ +user_data:
+ -
+ -
+ operatingType: create
+ User: testUser
+ Username: testUser
+ Password: '111111'
+ ConfirmPassword: '111111'
+ E-mail: [email protected]
+ Mobile: test123
+ Role:
+ -
+ RoleText: test
+ Enable: open
+ searchCriteria: User
+ -
+ operatingType: edit
+ User: testUser111
+ searchCriteria: User #搜索条件
+
+user_column_setup_data:
+ -
+ column_setup_position: click
+ cancel_show:
+ - Role
+ - Last login time
+ save_column_setup: click
+ assertPosition:
+ - xpath=//*[@id="userTable"]/div[2]/table/thead/tr/th[5]/div/span
+ - xpath=//*[@id="userTable"]/div[2]/table/thead/tr/th[7]/div/span
+
\ No newline at end of file diff --git a/other/data/template/page_template.yaml b/other/data/template/page_template.yaml new file mode 100644 index 0000000..847f24b --- /dev/null +++ b/other/data/template/page_template.yaml @@ -0,0 +1,78 @@ +#user正向用例
+user_page:
+ #"打开页面数据":
+ openCreateOrEditPage:
+ create:
+ - xpath=//*[@id="app"]/div/div[1]/ul[2]/li[6]/div/span
+ - xpath=//*[@id="app"]/div/div[1]/ul[2]/li[6]/ul/li[1]
+ - id=account-add
+ edit:
+ - xpath=//*[@id="userTable"]/div[4]/div[2]/table/tbody/tr/td[11]/div/div/div/div
+ - xpath=/html/body/ul/li[1]
+
+ templateData:
+ -
+ type: input
+ position: id=account-input-name
+ value: User
+ -
+ type: input
+ position: id=account-input-username
+ value: Username
+ -
+ type: input
+ position: id=account-input-password
+ value: Password
+ -
+ type: input
+ position: id=account-input-pinChange
+ value: ConfirmPassword
+ -
+ type: input
+ position: id=account-input-email
+ value: E-mail
+ -
+ type: input
+ position: id=account-input-mobile
+ value: Mobile
+ -
+ type: combination
+ position: id=account-input-roleIds
+ value: Role
+ data:
+ -
+ type: clickText
+ value: RoleText
+ data: null
+ -
+ type: switch
+ position: xpath=//*[@id="app"]/div/div[2]/div[2]/div/div[2]/div[2]/div/form/div[8]/div/div
+ value: Enable
+ default: open
+ -
+ type: click
+ position: xpath=//*[@id="app"]/div/div[2]/div[2]/div/div/div/div[2]/div[1]/div[2]/button[2]
+ value: column_setup_position
+ -
+ type: columnSetup
+ value: cancel_show
+ -
+ type: click
+ position: xpath=/html/body/div[1]/div/div[2]/div[2]/div/div/div/div[3]/div[3]/div/button[2]
+ value: save_column_setup
+ -
+ type: click
+ position: xpath=//*[@id="userTable"]/div[4]/div[2]/table/tbody/tr[1]/td[11]/div/div/button
+ value: OperationLog
+ -
+ type: click
+ position: xpath=//*[@id="userTable"]/div[4]/div[2]/table/tbody/tr[1]/td[11]/div/div/button
+ value: OperationLog
+ okOrCancel:
+ position: id=asset-edit-save #创建修改确定按钮
+ search: type1 #搜索框种类,不同页面搜索框定位可能不相同
+ User: xpath=//*[@id="userTable"]/div[3]/table/tbody/tr[1]/td[3]/div/span #Name定位 因搜索条件为User故该key为User
+ ID: xpath=//*[@id="userTable"]/div[3]/table/tbody/tr[1]/td[2]/div/span # ID定位
+ delete: id=account-list-batch-delete #删除按钮定位
+ Selected: xpath=//*[@id="userTable"]/div[3]/table/tbody/tr/td[1]/div/label/span/span #查询后第一条数据的选中框定位
+
\ No newline at end of file diff --git a/variable/all_flow_case_variable.txt b/variable/all_flow_case_variable.txt new file mode 100644 index 0000000..2776bfb --- /dev/null +++ b/variable/all_flow_case_variable.txt @@ -0,0 +1 @@ +*** Variables ***
diff --git a/variable/common_variable.txt b/variable/common_variable.txt new file mode 100644 index 0000000..d0aa1fd --- /dev/null +++ b/variable/common_variable.txt @@ -0,0 +1,75 @@ +*** Variables ***
+#登录类型:api | cli | ${None}(tsg mib) | 未指定,默认为ui
+${loginType} ui
+#执行环境是否Widonws
+${systemType} Windows
+#API配置信息
+${host} 192.168.44.100
+${port} 8080
+${authmode} 1
+${authCode} ${EMPTY}
+${ldapId} 27
+${version} v1
+${version2} v2
+${username} dongxiaoyan
+${password} dongxiaoyan
+${encodePassword} ${EMPTY}
+${token} ${EMPTY}
+#[Documentation] 测试终端IP统一配置
+${testClentIP} 192.168.32.116
+${testSubscriberID} $test19
+#自动化标签
+${userTagIds} ${EMPTY}
+#Documentation] 是否添加测试终端IP到策略统一配置,0为不添加测试终端IP,1为添加测试终端IP,默认1
+${addTestClentIPFlag} 1
+#测试环境是否需要把tsgui和api添加为SecurityPolicy-Allow 1为需要,默认1 ,
+${addTsgUIAPIFlag} 1
+#执行需要暂停时间
+#策略下发后到验证需等待时间
+${policyVerificationSleepSeconds} 20
+#策略验证后到验证策略日志需等待时间
+${policyLogVerificationSleepSeconds} 60
+${path} C:/Users/admin/Desktop/sql/gap_nezha_ui/other/
+${Downloadpath} C:/Users/byb11/Downloads/
+${curlbatpath} ${path}curl/
+${mailpath} ${path}/mail/
+${responsePageFiles} ${path}/response_pages_files/
+#全流程分阶段测试参数
+#[Documentation] 当前测试部分,all为一个终端全网全流程测试,
+#1为添加策略和对象测试;
+#2为功能端业务验证部分测试;
+#3为llog日志验证测试
+${testPart} all
+#UI配置的本地IP名称
+${LocahIPName} ${EMPTY}
+${ipType} ipv4
+${ipMask} 255.255.255.255
+${browserType} chrome
+# Cli自动化测试变量[start]
+${cliHost} 192.168.40.165
+${cliUsername} tsgadmin
+${cliPassword} Cli2019
+${timeout} 600s
+${retryInterval} 300s
+@{PolicyTypes} tsg_security pxy_manipulation
+@{ObjectTypes} ip url fqdn keywords subscriberid fqdn_category account
+... http_signature
+# Cli自动化测试变量[end]
+# SNMP服务测试变量[start]
+${snmpHost} 192.168.40.165
+${snmpPort} 50161
+${snmpConnTimeout} 5 # 默认超时时间为6s,设置timeout值后超时时间为n*6s
+${snmpCommunity} public
+# SNMP服务测试变量[end]
+#API配置信息
+${oamHost} 192.168.40.210
+${oamPort} 50080
+${contrast} 0.1
+${editpasswd} no #设置密码过期时是否需要修改密码,no为不修改,yes为修改
+# Mysql数据库连接信息
+${mysqlHost} host='192.168.44.72',port=3306,user='root',passwd='bifang!@#',database='tsg-bifang'
+#休息时间
+${sleep_min} 1
+${sleep} 2
+# 隐式等待时间
+${sleep_Wait} 20
diff --git a/variable/config.yml b/variable/config.yml new file mode 100644 index 0000000..dab8c3e --- /dev/null +++ b/variable/config.yml @@ -0,0 +1,38 @@ +#待执行的产品项目, Cloud -云项目; rfcode -执行所有的项目
+#https://www.cnblogs.com/jun-zi/p/12055300.html
+ProductItem: Cloud
+
+#待执行的测试套件(标签), all -所有的测试套件: debug -调试中套件; login -登录功能 ; filter -账号筛选: P1 -一级用例
+testSuite: P1
+
+#测试报告标题
+testReportTitle: Cloud_Report
+
+#失败重试开关, 0 -关, 1 -开 ,开启后默认重试一次
+retry_switch: 0
+#失败重试次数
+retryTime: 1
+
+#发送测试报告邮件开关, 0 -关, 1 -开
+emailSwitch: 1
+
+#邮件配置
+#发件邮箱
+smtp_server: smtp.126.com
+server_username: [email protected]
+server_pwd: XXXXXX
+#收件人(列表)
+msg_to:
+
+#邮件主题
+msg_subject: '[XX项目][测试环境-develop][jira号][自动化测试报告]'
+
+#日志级别(字典),由高到低: CRITICAL 、 ERROR 、 WARNING 、 INFO 、 DEBUG
+log:
+ file_name: test.log
+ backup: 5
+ console_level: DEBUG #控制台日志级别
+ file_level: DEBUG #文件日志级别
+ pattern: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
\ No newline at end of file diff --git a/variable/file_operation.robot b/variable/file_operation.robot new file mode 100644 index 0000000..48c942f --- /dev/null +++ b/variable/file_operation.robot @@ -0,0 +1,36 @@ +*** Settings ***
+Library String
+Library json
+Library OperatingSystem
+Library RequestsLibrary
+Library Selenium2Library
+Library Collections
+Library FileLibrary
+Resource ../common.robot
+Resource ../../../variable/common_variable.txt
+
+*** Keywords ***
+insert_policyId_to_file
+ [Arguments] ${key} ${policyId} ${objectids}
+ ${dict} Create Dictionary policyId=${policyId} objectId=${objectids}
+ ${json} json.Dumps ${dict}
+ Alter Dict ${path}/variable/AllFlowCaseVariable.txt ${key} ${json}
+
+insert_time_to_file
+ [Arguments] ${key} ${starttime} ${endtime}
+ ${value} json.Loads ${${key}}
+ ${dict} Create Dictionary policyId=${value}[policyId] objectId=${value}[objectId] starttime=${starttime} endtime=${endtime}
+ ${json} json.Dumps ${dict}
+ Alter Dict ${path}/variable/AllFlowCaseVariable.txt ${key} ${json}
+
+insert_policyId_to_file1
+ [Arguments] ${key} ${objectids}
+ Alter Dict ${path}/all_flow_case_variable.txt ${key} ${objectids}
+
+insert_time_to_file1
+ [Arguments] ${key} ${starttime}
+ Alter Dict ${path}/AllFlowCaseVariable1.txt ${key} ${starttime}
+
+insert_Report_to_file1
+ [Arguments] ${key} ${objectids}
+ Alter Dict ${path}/ReportCaseVariable.txt ${key} ${objectids}
diff --git a/variable/policy_object_default.txt b/variable/policy_object_default.txt new file mode 100644 index 0000000..d38e644 --- /dev/null +++ b/variable/policy_object_default.txt @@ -0,0 +1,53 @@ +*** Variables ***
+# 通用
+${Default_IsValid} ${1}
+${Default_IsDelete} false
+
+# 策略
+${Default_PolicyName} autotest_policy
+${Default_PolicyType} tsg_security
+${Default_PolicyDesc} autotest
+${Default_Action} deny
+${Default_PolicySubAction} drop
+${Default_EffectiveRange}
+${Default_UserRegion} method:rst
+${Default_ReferenceObject} ${EMPTY}
+${Default_AppObjectIdArray} []
+${Default_UserTags} ${EMPTY}
+${Default_DoLog} ${1}
+${Default_ScheduleId} ${EMPTY}
+#策略v2
+${Default_v2_SourceObject} ${EMPTY}
+${Default_v2_DestinationObject} ${EMPTY}
+${Default_v2_FilterObject} ${EMPTY}
+# 对象
+${Default_ObjectType} ip
+${Default_CategoryType} fqdn
+${Default_ObjectSubType} ${EMPTY}
+${Default_IsInitialize} ${0}
+${Default_IsExclusion} ${0}
+${Default_ObjectName} autotestobj
+${Default_ObjectDesc} autotestobj
+${Default_SubObjectIds} ${None}
+${Default_Dimension} Function
+${Default_Origin} net
+${Default_AddItem_AddrType} ${4}
+${Default_AddItem_Protocol} ${0}
+${Default_AddItem_Direction} ${0}
+${Default_AddItem_IsSession} endpoint
+${Default_AddItem_ServerIpFormat} range
+${Default_AddItem_ServerIp1} ${EMPTY}
+${Default_AddItem_ServerIp2} ${EMPTY}
+${Default_AddItem_ServerPort} ${0}/${0}
+${Default_AddItem_IsHexbin} ${0}
+${Default_AddItem_IsInitialize} ${0}
+${Default_AddItem_ItemName} ${EMPTY}
+${Default_AddItem_ItemDesc} ${EMPTY}
+#默认客户端条件类型:clientip or clientsubid or clientImsi or clientPhoneNumber or clientApn
+${Default_Client_Type} clientip
+${Default_Client_subidType} clientsubid
+${Default_Client_imsiType} clientImsi
+${Default_Client_phonenumberType} clientPhoneNumber
+${Default_Client_apnType} clientApn
+${Default_PolicyEnabled} open
+${Default_PolicyLogSession} 1
\ No newline at end of file diff --git a/variable/模板说明.txt b/variable/模板说明.txt new file mode 100644 index 0000000..bb211dd --- /dev/null +++ b/variable/模板说明.txt @@ -0,0 +1,134 @@ +yaml语法请参考网上教程:
+https://www.runoob.com/w3cnote/yaml-intro.html
+https://www.cnblogs.com/sddai/p/9626392.html
+
+模板编写:
+页面的模板命名为:页面名称_page,全小写多单词下划线分隔,一个模板主要包括:OpenCreateOrEditPage、PageData、OkOrCancel 三部分。
+OpenCreateOrEditPage:分为create和edit两个部分,主要存放进入创建页面或者修改页面的元素定位信息。
+ 编写规则:
+ OpenCreateOrEditPage:
+ create:
+ - 一级定位
+ - 二级定位
+ ...
+ - 创建按钮定位
+ edit:
+ - 修改按钮定位
+
+PageData:以列表形式记录创建修改数据时页面每一步操作。
+ 编写规则:
+ PageData:
+ -
+ type: input
+ position: id=responsepages_profileName1
+ value: profileName
+ -
+ type: upload
+ position: xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div/div/div/div/input
+ value: file
+
+ type: 操作类型,暂时有input、upload、click、combination、switch、switchCombination、radioButton
+
+ input: 用于页面输入操作
+ type: input
+ position: 输入框定位
+ value: 输入框名称(同数据文件中记录输入内容字典的key值一致)
+
+ upload:上传文件操作
+ type: upload
+ position: 上传文件定位
+ value: 上传文件控件名称(同数据文件中记录文件路径的字典key值一致)
+
+ click:点击按钮操作
+ type: click
+ position: 按钮定位
+ value: 按钮名称
+
+ combination:应用于多级操作,递归执行combination下的操作。
+ 下面该多级操作为Insert Script创建页面对Script Type的操作,请参考页面。
+ type: combination
+ position: id=insert_select_format
+ value: Script Type
+ data:
+ -
+ type: click
+ position: xpath=/html/body/div/div[1]/div[1]/ul/li[1]
+ value: css
+ data: null
+ -
+ type: click
+ position: xpath=/html/body/div/div[1]/div[1]/ul/li[2]
+ value: js
+ data:
+ -
+ type: click
+ position: id=insert_select_insertOn
+ value: Insert on
+ data:
+ -
+ type: click
+ position: xpath=/html/body/div[last()]/div[1]/div[1]/ul/li[1]
+ value: Before Page Load
+ data: null
+
+ switch:开关按钮
+ type: switch
+ position: 按钮的定位
+ value: 按钮的名称(同数据文件中记录按钮状态的字典key值一致)
+ default: 按钮的默认状态(open、close)
+
+ switchCombination:开关按钮的组合操作。
+ type: switchCombination
+ position: 开关按钮定位
+ value: 按钮的名称(同数据文件中记录按钮状态的字典key值一致)
+ default: 按钮的默认状态(open、close)
+ data:
+ -
+ type: input
+ position: id=hijack_contentName
+ value: downloadName
+
+ radioButton:单选按钮
+ type: radioButton
+ position:null (由于没有定位所有给null)
+ value: Fail Action
+ data:
+ -
+ type: click
+ position: id=decryptionfail-close
+ value: Fail-close
+ -
+ type: click
+ position: id=decryptionpass-through
+ value: Pass-through
+
+OkOrCancel:记录点击Ok按钮及断言信息。
+ OkOrCancel:
+ position: Ok按钮定位
+ confirm: 确认信息操作
+ alerm: 创建成功断言定位信息
+ assertPosition: 搜索结果断言定位(name的定位)
+
+模板样例:
+response_page_page:
+ OpenCreateOrEditPage:
+ create:
+ - id=Settings
+ - xpath=//*[@id="Settings"]/ul/li[1]
+ - id=responseAdd
+ edit:
+ - id=resinseEdit
+ PageData:
+ -
+ type: input
+ position: id=responsepages_profileName1
+ value: profileName
+ -
+ type: upload
+ position: xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div/div/div/div/input
+ value: file
+ OkOrCancel:
+ position: id=responseAddOk1
+ confirm: 确认信息操作
+ alerm: id=responseAdd
+ assertPosition: xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/div/span
diff --git a/variable/测试用例说明.txt b/variable/测试用例说明.txt new file mode 100644 index 0000000..ea010f0 --- /dev/null +++ b/variable/测试用例说明.txt @@ -0,0 +1,134 @@ +数据文件:
+ 数据文件用来存放页面的测试用例数据,所有测试用例在yaml文件中以列表形式存在,每个测试用例内由字典组成。
+
+数据文件的命名:
+ 数据文件命名全小写多单词下划线分隔+_data,例:response_page_data
+
+测试用例编写规则:
+ 页面所有测试用例以列表形式作为字典的value保存在文件内,字典的key同文件名一致,例:
+ response_page_data:
+ -
+ 测试用例1
+ -
+ 测试用例2
+ ...
+
+模板内不同操作类型对应用例编写方式:
+ input: 文本框输入
+ 模板:
+ type: input
+ position: id=responsepages_profileName1
+ value: profileName
+ 用例:
+ profileName:输入的文本
+
+ upload:上传文件
+ 模板:
+ type: upload
+ position: 上传文件定位
+ value: file
+ 用例:
+ file:文件路径
+
+ click:点击
+ 模板:
+ type: click
+ position: 按钮定位
+ value: buttonName
+ 用例:
+ buttonName:null (由于按钮不需传入定位等数据,所有value值可任意)
+
+ combination:应用于多级操作,递归执行combination下的操作。
+ 该操作为多级操作,编写用例时要与模板的层级对应
+ 模板:
+ 下面该多级操作为Insert Script创建页面对Script Type的操作,请参考页面。
+ type: combination
+ position: id=insert_select_format
+ value: Script Type
+ data:
+ -
+ type: click
+ position: xpath=/html/body/div/div[1]/div[1]/ul/li[1]
+ value: css
+ data: null
+ -
+ type: click
+ position: xpath=/html/body/div/div[1]/div[1]/ul/li[2]
+ value: js
+ data:
+ -
+ type: click
+ position: id=insert_select_insertOn
+ value: Insert on
+ data:
+ -
+ type: click
+ position: xpath=/html/body/div[last()]/div[1]/div[1]/ul/li[1]
+ value: Before Page Load
+ data: null
+ 用例:
+ Script Type:
+ -
+ js:
+ -
+ Insert on:
+ - Before Page Load
+
+ switch:开关按钮
+ 模板:
+ type: switch
+ position: 按钮的定位
+ value: switchName(按钮的名称)
+ default: open(按钮的默认状态open、close)
+ 用例:
+ switchName:close
+
+ switchCombination:开关按钮的组合操作。
+ 模板:
+ type: switchCombination
+ position: 开关按钮定位
+ value: switchCombinationName(按钮的名称)
+ default: open(按钮的默认状态open、close)
+ data:
+ -
+ type: input
+ position: id=hijack_contentName
+ value: downloadName
+ 用例:
+ switchCombinationName:
+ -
+ action:close
+ -
+ downloadName:输入的文本
+
+ radioButton:单选按钮
+ 模板:
+ type: radioButton
+ position:null (由于没有定位所有给null)
+ value: Fail Action
+ data:
+ -
+ type: click
+ position: id=decryptionfail-close
+ value: Fail-close
+ -
+ type: click
+ position: id=decryptionpass-through
+ value: Pass-through
+ 用例:
+ Fail Action:Fail-close
+
+
+测试用例样例:
+ response_page页面创建+修改测试用例
+ response_page_data:
+ -
+ -
+ operatingType: create
+ profileName: testname
+ file: responsepage/creat_response_pages.htm
+ -
+ operatingType: edit
+ profileName: Edittestname
+ file: responsepage/creat_response_pages.htm
+ -
\ No newline at end of file |
