Robotframework 使用Robot框架重新运行TestSuite,并使用不同的登录信息进行骑乘

Robotframework 使用Robot框架重新运行TestSuite,并使用不同的登录信息进行骑乘,robotframework,robotframework-ide,Robotframework,Robotframework Ide,我已经用Robot框架和Ride做了一些测试套件,包括几个测试用例 这需要启动web浏览器和用户登录网站 不需要复制TestSuite/testcase和硬编码其他浏览器和用户登录, 我如何重新使用和重新运行现有的浏览器,只需先更改使用过的浏览器, 然后用user2重新运行相同的程序 测试用例类似于: Open Browser - Chrome #Open Browser - Firefox Login1 #Login2 Do something.... #For loop already u

我已经用Robot框架和Ride做了一些测试套件,包括几个测试用例 这需要启动web浏览器和用户登录网站

不需要复制TestSuite/testcase和硬编码其他浏览器和用户登录, 我如何重新使用和重新运行现有的浏览器,只需先更改使用过的浏览器, 然后用user2重新运行相同的程序

测试用例类似于:

Open Browser - Chrome
#Open Browser - Firefox 
Login1
#Login2
Do something....
#For loop already used inside the testcase
FOR    ${var}    IN    IN RANGE    1    10
    Exit For Loop If    Some condition is true
    ${var} =    Evaluate    ${var} + 1
    #do something until condition is true
    Scroll Element Into View    test_element
    Set Focus To Element    test_element
END
Continue test case....
关键词:

Open Browser - Chrome
Open Browser    https://test.testpage.com/  chrome
......
Open Browser - Firefox
Open Browser    https://test.testpage.com/  ff
......
Login1
Wait Until Element Is Visible   test_Login_username 
Input Text  test_Login_username test.id1
Input Password  test_Login_password test.password1
Click Button    test_Login_LoginBtn
.....
Login2
Wait Until Element Is Visible   test_Login_username 
Input Text  test_Login_username test.id2
Input Password  test_Login_password test.password2
Click Button    test_Login_LoginBtn     
例如,我知道我可以将浏览器设置为类似循环的

*** Variables ***
@{BROWSERS}       Chrome    ff
然后在测试用例中循环它们,就像

FOR    ${Browser}    IN    @{BROWSERS}
    Open Browser    https://test.testpage.com/    ${Browser}
END

但这里的问题是,不能使用嵌套for循环???

确实,RF中不能使用嵌套循环。还有一个简单的解决方法:

您的代码示例对我来说似乎有点混乱,所以我不会将其作为示例使用。但总的来说,我会:

  • 使用表示某些测试步骤的for循环创建关键字
  • 实现一个测试用例,我在不同的浏览器上循环执行关键字from 1。在for循环内部

  • 我看不出有任何必要提及和标记这辆车。这是一个编码/结构问题。可以删除标签robotframeworkide。
    *** Keywords ***
    Handle Table
        [Arguments]    @{table}
        FOR    ${row}    IN    @{table}
            Handle Row    @{row}
        END
    
    Handle Row
        [Arguments]    @{row}
        FOR    ${cell}    IN    @{row}
            Handle Cell    ${cell}
        END