Is there any Robot keyword for starting a server(.sh) script and capture the response in a text file or a variable?

144 views Asked by At

I am having a ".sh" server script i want to run this file in my VM, after running i will send a curl request in my VM then this server will receive a response i want to capture the whole response in a file or variable. I have tried to run the server it was successful but i am stuck with how to capture the response also how to switch back to this server and capture the response after sending curl request.

CLI    COL_VM    cd server_path/                        prompt=$  timeout=30
${result}      CLI    COL_VM    ./server.sh             timeout_exception=0

where COL_VM is the device details which will help to login to that VM.

2

There are 2 answers

0
Niranjan Mahesh On BEST ANSWER

Instead of trying to capture the response from server, i captured the curl request's response itself.

${curl}      CLI    COL_VM    curl -X GET \http://localhost:8083/Path \ -d 'curl_request_json_which_we_are_sending'
0
King On

If your VM has ssh enabled one of the options would be a custom library using Python's Paramiko interface. It is pretty simple to use. There were many questions about it here, e.g.

I use it in Robot Framework to run commands and scripts on Linux servers and verify their output (both stdout and stderr).