I'm quite new with Robot Framework, and I cannot find a way to run a process with arguments on windows. I am quite sure I did not understand the documentation and there is a simple way of doing that though...
Ok, let's say I can start my program using this command:
c:\myappdir>MyApp.exe /I ..\params\myAppParams.bin
How to do that in RF?
Any kind of help would be appreciated. Thank you very much :)
Edit 1:
Here is a piece of my code:
| *Setting* | *Value*
| Resource | compilationResource.robot
#(Process lib is included in compilationResource)
#I removed the "|" for readability
...
TEST1
...
${REPLAYEXEDIR}= get_replay_exe_dir #from a custom lib included in compilationResource
${EXEFULLPATH}= Join Path ${WORKSPACEDIR} ${REPLAYEXEDIR} SDataProc.exe
Should Exist ${EXEFULLPATH}
${REPLAYLOGPATH}= Join Path ${WORKSPACEDIR} ReplayLog.log
${REPLAYFILEPATH}= Join Path ${WORKSPACEDIR} params params.bin
Should Exist ${REPLAYFILEPATH}
Start Process ${EXEFULLPATH} stderr=${REPLAYLOGPATH} stdout=${REPLAYLOGPATH} alias=replayjob
Process Should Be Running replayjob
Terminate Process replayjob
Process Should Be Stopped replayjob
This works. As soon as I try to include the arguments like this:
Start Process ${EXEFULLPATH} ${/}I ${REPLAYFILEPATH} stderr=${REPLAYLOGPATH} stdout=${REPLAYLOGPATH} alias=replayjob
I get this error:
WindowsError: [Error 2] The system cannot find the file specified
and this error comes from the start process line.
Let me know if I was unclear or if nmore info is needed. Thank you all for your help on this.
Edit 2: SOLUTION
Each argument must be separated form the other (when not running in shell) with a double space. I was not using double spaces, hence the error.
| | Start Process | ${EXEFULLPATH} | /I | ${REPLAYFILEPATH} | stderr=${REPLAYLOGPATH} | stdout=${REPLAYLOGPATH} | alias=replayjob
Robot uses two or more spaces to separate arguments from keywords. You need at least two spaces after Powershell.exe . You should also use a forward slash instead of a backwards slash in the filename, or use a double-backwards-slash since a single slash is an escape character. Save this answer.
Execute command - Executes the command in interactive shell. Get File - Downloads the given file from remote machine to local machine. Put File - Uploads asked file from local to remote machine. write - Writes command into interactive shell and waits for next command!
To launch your program from a Robot Framework Test, use the Process library like:
*** Settings ***
Library Process
*** Test Cases ***
First test
Run Process c:${/}myappdir${/}prog.py /I ..\params\myAppParams.bin
# and then do some tests....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With