小编lih*_*_h3的帖子

如何在 Robot Framework 中使用条件使测试失败

我在 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
Run Code Online (Sandbox Code Playgroud)

机器人框架代码:

${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 …
Run Code Online (Sandbox Code Playgroud)

robotframework

3
推荐指数
1
解决办法
7568
查看次数

标签 统计

robotframework ×1