diff options
Diffstat (limited to 'variable')
| -rw-r--r-- | variable/all_flow_case_variable.txt | 1 | ||||
| -rw-r--r-- | variable/common_variable.txt | 75 | ||||
| -rw-r--r-- | variable/config.yml | 38 | ||||
| -rw-r--r-- | variable/file_operation.robot | 36 | ||||
| -rw-r--r-- | variable/policy_object_default.txt | 53 | ||||
| -rw-r--r-- | variable/模板说明.txt | 134 | ||||
| -rw-r--r-- | variable/测试用例说明.txt | 134 |
7 files changed, 471 insertions, 0 deletions
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 |
