美文网首页Robotframework
RF-SSHLibrary测试库「用于SSH和SFTP」

RF-SSHLibrary测试库「用于SSH和SFTP」

作者: 测试界 | 来源:发表于2019-10-30 01:07 被阅读0次

    安装方法:

    pip install --upgrade robotframework-sshlibrary

    脚本分享:

    *** Settings ***

    Library SSHLibrary

    *** Variables ***

    ${username} root

    ${password} root

    ${i_item} empty

    *** Keywords ***

    get_pid_kill

    ${pid_list} Evaluate '''${i_item}'''.split()

    ${pid_item} Evaluate ${pid_list}[1]

    # ${pid_len} Evaluate len(${pid_list})

    # :FOR ${j} IN RANGE ${pid_len}

    # \ log ${j}

    # \ ${pid_item} Evaluate ${pid_list}[${j}]

    # \ log

    Execute Command kill -9 ${pid_item}

    *** Test Cases ***

    219服务器

    [Tags] 219

    Open Connection ip

    ${output}= Login ${username} ${password}

    Should Contain ${output} \#

    ${rc} Execute Command ps -ef |grep tomcat

    ${rc_list} Evaluate '''${rc}'''.splitlines() modules=string

    ${rc_list_len} Evaluate len(${rc_list})

    :FOR ${i} IN RANGE ${rc_list_len}

    \ log ${i}

    \ ${i_item} Evaluate ${rc_list}[${i}]

    \ ${i_res} Run Keyword And Return Status Should Contain ${i_item} java

    \ Set Suite Variable ${i_item}

    \ Run Keyword If '${i_res}'=='True' get_pid_kill

    Close Connection

    相关文章

      网友评论

        本文标题:RF-SSHLibrary测试库「用于SSH和SFTP」

        本文链接:https://www.haomeiwen.com/subject/cgmnvctx.html