diff options
Diffstat (limited to 'keyword/common/systemcommand.robot')
| -rw-r--r-- | keyword/common/systemcommand.robot | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/keyword/common/systemcommand.robot b/keyword/common/systemcommand.robot new file mode 100644 index 0000000..cc96c8c --- /dev/null +++ b/keyword/common/systemcommand.robot @@ -0,0 +1,63 @@ +*** Settings *** +Library OperatingSystem +Library Selenium2Library +Library RequestsLibrary +Library Collections +Resource ../../variable/common_variable.txt + +*** Keywords *** +SystemCommands + [Arguments] ${commandstr} ${stringlist} + log toSystemCommand_SystemCommandTest + ${commandreturn} OperatingSystem.Run ${commandstr} + Append To File ${path}/write_file.txt ${commandstr} + Append To File ${path}/write_file.txt %%%%%%%%%%%%%%newbat + Append To File ${path}/write_file.txt ${commandreturn} + ${listlenth}= Get Length ${stringlist} + FOR ${var} IN RANGE ${listlenth} + #log ${var} + Should Contain ${commandreturn} ${stringlist}[${var}] + END + ${rescode} Set Variable 200 + log ${rescode} + [Return] ${rescode} + +SystemCommand + [Arguments] ${commandstr} @{stringlist} + log dxytest${commandstr} + ${commandreturn} OperatingSystem.Run ${commandstr} + #nslookup -d www.jd.com + log ${commandreturn} + FOR ${var} IN @{stringlist} + log dxytest + log ${var} + Should Contain ${commandreturn} ${var} + END + #Should Contain ${commandreturn} ${qatype} + ${rescode} Set Variable 200 + log ${rescode} + [Return] ${rescode} + + +SystemCommandReturnCompare + #执行命令并比对命令返回结果 需要执行的系统命令 命令返回结果要包含的字符串列表 命令返回结果不能包含的字符串列表 + [Arguments] ${commandstr} ${stringlist} ${stringlistnotin} + log toSystemCommand_SystemCommandTest + ${commandreturn} OperatingSystem.Run ${commandstr} + Append To File ${path}/write_file.txt ${commandstr} + Append To File ${path}/write_file.txt %%%%%%%%%%%%%%newbat + Append To File ${path}/write_file.txt ${commandreturn} + #${commandreturn} Set Variable abcdeConnection was reset + ${listlenth}= Get Length ${stringlist} + FOR ${var} IN RANGE ${listlenth} + log ${var} + Should Contain ${commandreturn} ${stringlist}[${var}] + END + ${listnotin}= Get Length ${stringlistnotin} + FOR ${varn} IN RANGE ${listnotin} + log ${varn} + Should Not Contain ${commandreturn} ${stringlistnotin}[${varn}] + END + ${rescode} Set Variable 200 + log ${rescode} + [Return] ${rescode} |
