【发布时间】:2019-08-26 09:08:02
【问题描述】:
我无法在 Robot Framework 中编写 if 条件。 我需要知道进程是否失败\成功\仍在进行中。 我有一个超时循环,一直等到进程失败\成功(完成)
我不知道如何:
- 从案例中刹车并失败测试 - 仅当过程失败时。
- 从案例中刹车并通过测试 - 仅当过程“成功”\完成时。
这里是python代码:
for i in range(timeout):
if wait_for_failed_proccess is True:
result = False
break
if wait_for_success_process is True:
result = True
break
time.sleep(1000)
return result
机器人框架代码:
${result} = Test process waiter
Run keyword if| ${result}==False---> need to fail test. the process has failed
Run keyword if| ${result}==True---> test passed. continue to the next test
Test process waiter
[documentation] wait until process is done
[timeout] 25 min
For ${index} IN RANGE [TIMEOUT]
run keyword if|Validate failed process==Ture|${result}=False|Exist From loop
run keyword if|Validate success process==Ture|${result}=True|Exist From loop
Sleep 10
END
[return] result
Validate failed process
[documentation] confirmed process failed
Element should contain ${message} Failed
Validate success process
[documentation] confirmed process is done
Element should contain ${message} Completed successfully
【问题讨论】:
标签: robotframework