1
*** Settings ***

    Documentation      Transfer a file from OCU to PC
    Library            SSHLibrary
    Suite Setup        Open Connection and Login With Public Key
    Suite Teardown     Close All Connections

*** Variables ***

    ${REMOTE HOST}    192.168.x.xxx
    ${USER}           xxx

*** Keywords ***

    Open Connection and Login With Public Key

    Open Connection     ${REMOTE HOST} 
    Login With Public Key     ${USER}     /home/bhushan/.ssh/id_rsa

*** Test Cases ***


    Run the given command on the console

    ${pwd}= Execute Command     pwd

    Should Be Equal     ${pwd}      /home/root 

    ${output}=  Execute Command     ls

    ${output}=  Execute Command        scp /home/root/myfile.txt bhushan@192.168.x.xxx:/home/bhushan/vdr-reports/
    Log ${output} 

我的目标上安装了最新版本的 Dropbear。我正在尝试运行上述基于 SSH 库机器人框架关键字的测试用例,该测试用例定义将文件从远程传输到本地主机。执行命令关键字在开始时起作用,即 ${output}= 执行命令 ls,但在复制文件时使用相同的关键字时出现错误,即我看不到控制台上发生的任何事情。它挂了,我等了很长时间才能看到输出,但什么也没看到。但是当我手动将文件复制到我的本地机器时,这有效。这里的任何人都可以尝试帮助我解决此错误。

关键字 ${输出} = SSHLibrary 。执行命令 scp /home/root/myfile.txt bhushan@192.168.x.xxx:/home/bhushan/vdr-reports/ 文档:command在远程机器上执行并返回其输出。开始/结束/经过:20170829 10:26:23.897 / 20170829 10:26:50.148 / 00:00:26.251 10:26:23.898 INFO 执行命令 'scp /home/root/myfile.txt bhushan@192.168.x.xxx :/home/bhushan/vdr-reports/'.......>

这是我在日志中看到的

4

0 回答 0