Search code examples
pythonpython-3.xrobotframeworkrobotframework-iderobotframework-sshlibrary

How to execute the commands in the Terminal using robot framework?


I want to execute the below commands in the Terminal using Robot Framework step by step. Any advice on how to go about it?

 1. ssh -o ProxyCommand\='ssh -W %h:%p xx.xx.xx.xx' xx.xvb.xyz.wq
 2. password
 3. sudo su - pentaho
 4. cd pentaho/design-tools/data-integration/
 5. sh kitchen.sh -file\=/ebs/pentaho/history/etljob.kjb

Solution

  • You can try using Process library.

    Keyword like Run Process seems promising:

    *** Settings ***
    Library    Process     
    
    *** Test Cases *** 
    Python Tiny Program
        ${result} =     Run Process     python    -c    print('Hello, world!') 
        Log    ${result.stdout}
    

    ${result} will be an object, you can use various properties like stdout, stderr, rc and others. It's described in the official doc.

    enter image description here