How to compare print output from python script (.py) in Robot framework

321 views
Skip to first unread message

Swati Rauniyar

unread,
Jul 14, 2021, 6:23:05 PM7/14/21
to robotframework-users
Hi All

I have written a python script for test automation. This script runs on Linux terminal. If test passed, it prints a string. I want to compare that string after running the python script from robot framework.

My python prints: "PASSED: Password updated" on successful completion. 

In Robot framework, I have written:

*** Test Cases ***

Update_Password
   ${result}=    Run   Process    python   //root//1_Update_Password.py
   Should Be Equal   ${result.stdout}  PASSED: Password updated

It is failing with message: != PASSED: Password updated
                                              ${result} = <result object with rc 1>

Thanks & Regards
Swati Rauniyar

Craig Despeaux

unread,
Jul 15, 2021, 12:38:14 PM7/15/21
to robotframework-users
I would add the following after you run the process which should help you figure out what's going on:

Log To Console  rc:${result.rc}
Log To Console  out:${result.stdout}
Log To Console  err:${result.stderr}

I'm sure if you do that you will find the issue.  It appears your command is failing for some reason based on the rc 1.

Good luck!
Craig

Reply all
Reply to author
Forward
0 new messages