【发布时间】:2017-08-09 05:32:48
【问题描述】:
为了测试,我做了 2 个关键字。总体思路是检查一系列对象是否存在某个字段、字段名和消息。如果字段或字段名不存在,则关键字必须返回到 forloop。关键字必须返回${index} 和${result}。当我运行这个测试并且它失败时,变量 ${results} 显示为${result}=None,当测试通过时它变成${result}= [3, u'PASS']
我认为这与forloop中的${result}=有关
我尝试了Run keyword and return,但它不起作用,我有点困惑将${variables} 放在哪里以及在哪里使用它。
谁能帮我解决这个问题?
FORLOOP:
${index}= | set variable | 0
${result}= | Set Variable | not started
: FOR | ${value} | IN RANGE | ${index} | 15
\ ${resultaat}= |"other keyword" | ${index}
\ ${index}= | "keyword add 1 to index" | ${index}
\ Return From Keyword if | '${result}'=='PASS'
${testsuccess}= | Set Variable If | '${result}'=='PASS' | TEST GESLAAGD
“其他关键字”是:
[ARGS] ${index}
${index}= | set variable | ${index}
${check1}= <IS FIELD THERE>
${result}= | set variable if | ${check1}==False | FIELD NOT THERE
return from keyword if | ${check1}=False
${check2}= <HAS FIELD VALUE X>
${result}= | set variable if | ${check2}==False | WRONG VALUE
return from keyword if | ${check2}=False
${check3}= <IS MESSAGE X>
${result}= | set variable if | ${check3}==False | FAIL
${result}= | set variable if | ${check3}==True | PASS
[RETURN] ${index} ${result}
日志:
关键字 = '${result}'=='PASS'
FOR = '${testsucces}=None'(但这样是不对的,因为条件已经满足了)
【问题讨论】:
标签: robotframework