我是Robot Framework的新手,我找不到在
Windows上运行带参数的进程的方法.我很确定我不理解文档,但有一种简单的方法可以做到这一点……
好吧,假设我可以使用此命令启动我的程序:
c:\myappdir>MyApp.exe /I ..\params\myAppParams.bin
如何在RF中做到这一点?
任何形式的帮助将不胜感激.
非常感谢你 :)
编辑1:
这是我的一段代码:
| *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
这有效.一旦我尝试包含这样的参数:
Start Process ${EXEFULLPATH} ${/}I ${REPLAYFILEPATH} stderr=${REPLAYLOGPATH} stdout=${REPLAYLOGPATH} alias=replayjob
我收到此错误:
WindowsError: [Error 2] The system cannot find the file specified
并且此错误来自启动流程行.
如果我不清楚或者是否需要更多信息,请告诉我.
谢谢大家对此的帮助.
编辑2:解决方案
每个参数必须与另一个参数(当不在shell中运行时)与双空格分开.我没有使用双空格,因此错误.
| | Start Process | ${EXEFULLPATH} | /I | ${REPLAYFILEPATH} | stderr=${REPLAYLOGPATH} | stdout=${REPLAYLOGPATH} | alias=replayjob
解决方法
要从Robot Framework Test启动程序,请使用
Process library,如:
*** Settings *** Library Process *** Test Cases *** First test Run Process c:${/}myappdir${/}prog.py /I ..\params\myAppParams.bin # and then do some tests....