From c2c9f609b844bc777d8e102a638b9797b9f66d01 Mon Sep 17 00:00:00 2001 From: dongxiaoyan Date: Tue, 7 Apr 2020 12:51:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 02-Keyword/tsg_bfapi/Common.robot | 7 ++- 02-Keyword/tsg_bfapi/LogSchema.robot | 2 +- 03-Variable/BifangApiVariable.txt | 26 +++++---- .../curl/ProxyPolicy_Redirect_http00002.bat | 2 +- .../curl/ProxyPolicy_Redirect_http00003.bat | 2 +- .../curl/ProxyPolicy_Redirect_ssl00007.bat | 2 +- .../curl/ProxyPolicy_Redirect_ssl00010.bat | 2 +- 05-Other/docker.txt | 24 ++++++++ 05-Other/response_pages_files/404china.html | 56 +++++++++++++++++++ 05-Other/response_pages_files/404english.html | 56 +++++++++++++++++++ 05-Other/response_pages_files/404russian.html | 56 +++++++++++++++++++ 11 files changed, 215 insertions(+), 20 deletions(-) create mode 100644 05-Other/docker.txt create mode 100644 05-Other/response_pages_files/404china.html create mode 100644 05-Other/response_pages_files/404english.html create mode 100644 05-Other/response_pages_files/404russian.html diff --git a/02-Keyword/tsg_bfapi/Common.robot b/02-Keyword/tsg_bfapi/Common.robot index cf68670..f827db1 100644 --- a/02-Keyword/tsg_bfapi/Common.robot +++ b/02-Keyword/tsg_bfapi/Common.robot @@ -6,15 +6,16 @@ Library RequestsLibrary *** Keywords *** BasePostRequest - [Arguments] ${apistr} ${body} + [Arguments] ${apistr} ${body} Set Headers {"Authorization":"${token}","Content-Type":"application/json"} - &{httpResponse} Post ${apistr} ${body} - Output response body + &{httpResponse} Post ${apistr} ${body} + #Output response body Object response body #Integer $.code 200 #Array $.data.policyList ${response} Set Variable ${httpResponse.body} [Return] ${response} + BaseDeleteRequest [Arguments] ${requestUri} ${data} ${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"} diff --git a/02-Keyword/tsg_bfapi/LogSchema.robot b/02-Keyword/tsg_bfapi/LogSchema.robot index 3abac5e..fcb8681 100644 --- a/02-Keyword/tsg_bfapi/LogSchema.robot +++ b/02-Keyword/tsg_bfapi/LogSchema.robot @@ -12,7 +12,7 @@ GetLogCondition Set Headers {"Content-Type":"application/x-www-form-urlencoded","Authorization":"${token}"} &{LogSchemaResponse}= GET /v1/log/schema?logType=${logname} log ${logname} - Output Schema response body + #Output Schema response body Object response body #Integer $.code 200 log ${LogSchemaResponse.body['data']} diff --git a/03-Variable/BifangApiVariable.txt b/03-Variable/BifangApiVariable.txt index 3fb2d32..e906579 100644 --- a/03-Variable/BifangApiVariable.txt +++ b/03-Variable/BifangApiVariable.txt @@ -1,6 +1,8 @@ *** Variables *** #ui登陆还是api登陆 ${loginType} api +#执行环境是否Widonws +${systemType} Windows #API配置信息 ${host} 192.168.40.120 ${port} 8080 @@ -13,19 +15,19 @@ ${password} 111111 ${encodePassword} ${EMPTY} ${token} ${EMPTY} #[Documentation] 测试终端IP统一配置 -${testClentIP} 192.168.50.43 +${testClentIP} 192.168.50.6 #自动化标签 -${userTagIds} ${EMPTY} +${userTagIds} ${EMPTY} #Documentation] 是否添加测试终端IP到策略统一配置,0为不添加测试终端IP,1为添加测试终端IP,默认1 ${addTestClentIPFlag} 1 #执行需要暂停时间 #策略下发后到验证需等待时间 ${policyVerificationSleepSeconds} 20 #策略验证后到验证策略日志需等待时间 -${policyLogVerificationSleepSeconds} 50 -${path} E:/auto_git/tsg_autotest -${curlbatpath} ${path}/05-Other/curl -${mailpath} ${path}/05-Other/mail +${policyLogVerificationSleepSeconds} 60 +${path} E:/auto_git/tsg_autotest/05-Other +${curlbatpath} ${path}/curl +${mailpath} ${path}/mail #全流程分阶段测试参数 #[Documentation] 当前测试部分,all为一个终端全网全流程测试, #1为添加策略和对象测试; @@ -38,10 +40,10 @@ ${ipType} ipv4 ${ipMask} 255.255.255.255 ${browserType} chrome # Cli自动化测试变量[start] -${cliHost} 192.168.40.165 -${cliUsername} tsgadmin -${cliPassword} Cli2019 -${timeout} 600s -${retryInterval} 300s -@{ObjectTypes} ip url fqdn keywords subscriberid fqdn_category account http_signature +${cliHost} 192.168.40.165 +${cliUsername} tsgadmin +${cliPassword} Cli2019 +${timeout} 600s +${retryInterval} 300s +@{ObjectTypes} ip url fqdn keywords subscriberid fqdn_category account http_signature # Cli自动化测试变量[end] diff --git a/05-Other/curl/ProxyPolicy_Redirect_http00002.bat b/05-Other/curl/ProxyPolicy_Redirect_http00002.bat index 0bdf913..62220f9 100644 --- a/05-Other/curl/ProxyPolicy_Redirect_http00002.bat +++ b/05-Other/curl/ProxyPolicy_Redirect_http00002.bat @@ -1 +1 @@ -curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'http://www.baidu.com/' \ http://www.ccb.com/cn/home/indexv3.html \ \ | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'http://www.baidu.com/' http://www.ccb.com/cn/home/indexv3.html | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/ProxyPolicy_Redirect_http00003.bat b/05-Other/curl/ProxyPolicy_Redirect_http00003.bat index 81f18e2..d894e3b 100644 --- a/05-Other/curl/ProxyPolicy_Redirect_http00003.bat +++ b/05-Other/curl/ProxyPolicy_Redirect_http00003.bat @@ -1 +1 @@ -curl --cookie "*_math=czsuv8n9d4p; Hm_lvt_92e8bc890f374994dd570aa15afc99e1=1575187416; Hm_lpvt_92e8bc890f374994dd570aa15afc99e1=1575187416; _uab_collina=157518741578524001717192" --referer 'http://www.baidu.com/' \ http://www.xiaozhu.com //| iconv -f utf-8 -t gbk \ No newline at end of file +curl --cookie "*_math=czsuv8n9d4p; Hm_lvt_92e8bc890f374994dd570aa15afc99e1=1575187416; Hm_lpvt_92e8bc890f374994dd570aa15afc99e1=1575187416; _uab_collina=157518741578524001717192" --referer 'http://www.baidu.com/' http://www.xiaozhu.com | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/ProxyPolicy_Redirect_ssl00007.bat b/05-Other/curl/ProxyPolicy_Redirect_ssl00007.bat index c11ec52..6ce14f5 100644 --- a/05-Other/curl/ProxyPolicy_Redirect_ssl00007.bat +++ b/05-Other/curl/ProxyPolicy_Redirect_ssl00007.bat @@ -1 +1 @@ -curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' \ https://www.gamersky.com/news/ \ \ | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.gamersky.com/news/ | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/curl/ProxyPolicy_Redirect_ssl00010.bat b/05-Other/curl/ProxyPolicy_Redirect_ssl00010.bat index 94905cf..6ea721f 100644 --- a/05-Other/curl/ProxyPolicy_Redirect_ssl00010.bat +++ b/05-Other/curl/ProxyPolicy_Redirect_ssl00010.bat @@ -1 +1 @@ -curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' \ https://www.twitch.tv/directory \ \ | iconv -f utf-8 -t gbk \ No newline at end of file +curl -kv --user-agent "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36" --referer 'https://www.baidu.com/' https://www.twitch.tv/directory | iconv -f utf-8 -t gbk \ No newline at end of file diff --git a/05-Other/docker.txt b/05-Other/docker.txt new file mode 100644 index 0000000..84311b2 --- /dev/null +++ b/05-Other/docker.txt @@ -0,0 +1,24 @@ +1、查看docker镜像 +docker images +2、进入docker镜像 +docker run -it auto-rf-library:1.0 /bin/bash +3、执行自动化项目 +docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-lib:latest[docker最新镜像] -d /newrepot/ robot tsg_autotest0406[project path] +执行添加hosts文件:使用自建服务器作为网页访问: +docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:1.0 robot -d newreport/ tsg_autotest0406 +执行不添加hosts文件: +docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:1.0 robot -d /newrepot/ tsg_autotest0406 + +docker start containerid +4、单独镜像,根据此目录下id,但是每次执行时不同的镜像id,修复此文件不太实用。修改hosts +cd /var/lib/docker/containers/ + +5、解决办法:使用cmd命令删除这些文件,我写了一个批处理文件,第一句是切换到临时文件的目录,第二句是循环,将名称未scoped_dir开头的文件夹都删掉 + +cd /d C:\Users\A127\AppData\Local\Temp +for /f %%i in ('dir /ad /b scoped_dir*') do (rd /s /q %%i) +1 +2 +然后在robotframework中,使用OperatingSystem中的run命令运行这个批处理文件,如下所示: + +Run Keyword And Ignore Error OperatingSystem.run cleartmp.bat diff --git a/05-Other/response_pages_files/404china.html b/05-Other/response_pages_files/404china.html new file mode 100644 index 0000000..a490e61 --- /dev/null +++ b/05-Other/response_pages_files/404china.html @@ -0,0 +1,56 @@ + + + + + + + + +404-对不起!您访问的页面不存在 + + + + + + + + + +
+ +
+ +
+ +

对不起,您请求的页面不存在、或已被删除、或暂时不可用

+ +

请点击以下链接继续浏览网页

+ +

返回上一页面

+ +

返回网站首页

+ +
+ +
+ + + + + diff --git a/05-Other/response_pages_files/404english.html b/05-Other/response_pages_files/404english.html new file mode 100644 index 0000000..9fd8aa9 --- /dev/null +++ b/05-Other/response_pages_files/404english.html @@ -0,0 +1,56 @@ + + + + + + + + +404 sorry! The page you visited does not exist + + + + + + + + + +
+ +
+ +
+ +

Sorry, the page you requested does not exist, has been deleted, or is temporarily unavailable

+ +

Please click the following link to continue browsing

+ +

Back to previous page

+ +

Back to home page

+ +
+ +
+ + + + + diff --git a/05-Other/response_pages_files/404russian.html b/05-Other/response_pages_files/404russian.html new file mode 100644 index 0000000..21d6fcd --- /dev/null +++ b/05-Other/response_pages_files/404russian.html @@ -0,0 +1,56 @@ + + + + + + + + + - 404, простите!  страница, к которой вы пришли, не существует  + + + + + + + + + +
+ +
+ +
+ +

 Извините, запрошенная страница не существует или была удалена или временно недоступна 

+ +

Продолжайте просматривать страницы

+ +

вернуться на предыдущую страницу 

+ +

вернуться на главную страницу сайта 

+ +
+ +
+ + + + +