在robotframework中,对于robot command,变量switch没有取带空格的值

问题描述 投票:0回答:0

我正在使用 shell 脚本运行我的机器人框架测试。 我能够传递变量并将它们包含在机器人命令中并执行它们就好了。

但是,如果我的变量值中包含空格字符,机器人命令将无法执行。

我的test.sh脚本

if [ -z "$DATEFORMAT" ]; then
    DATEFORMAT="dd/mm/yyyy hh:mm"
else
    DATEFORMAT=$DATEFORMAT
fi

echo dateformat=$DATEFORMAT

robot --variable dateformat:$DATEFORMAT system_test/features/test.robot

执行时,会导致以下错误:

[ ERROR ] Parsing 'hh:mm' failed: File or directory to execute does not exist.

Try --help for usage information.

如果我从 DATEFORMAT 值中删除字符 Space,那么它执行得很好。

DATEFORMAT="dd/mm/yyyyhh:mm"

我尝试在引号中的机器人命令中包含 $DATEFORMAT,但仍然出现相同的错误。

robot --variable dateformat:"'"$DATEFORMAT"'" system_test/features/test.robot
python shell selenium-webdriver robotframework
© www.soinside.com 2019 - 2024. All rights reserved.