首页 > 解决方案 > 在机器人框架中迭代测试用例

问题描述

我有一个测试用例,我必须迭代测试用例的次数。有什么方法可以迭代测试用例吗?

Signin-Personal-Account
[Tags]  Tvh2
    Given Number of users signs in to their respective devices  ${xyz}
    Then xyz sees that Sign in is successful
    When xyz signs out from the device
    Then xyz sees that sign out was successful   
    And Signin is repeated for 5 times for Ellie```

测试必须重复5次。如何使测试用例迭代次数?

标签: robotframework

解决方案


这可以使用 for 循环来实现:

*** Test cases ***
Multiple sign in test
    :FOR    ${index}    IN RANGE   5
    \    Signin-Personal-Account 

*** Keywords ***
Signin-Personal-Account
    [Tags]  Tvh2
    Given Number of users signs in to their respective devices  ${xyz}
    Then xyz sees that Sign in is successful
    When xyz signs out from the device
    Then xyz sees that sign out was successful   

FOR确保根据您使用的机器人框架版本检查循环语法 - FOR 循环语法


推荐阅读