编写包含多个关键字的测试模板

时间:2014-10-26 17:42:08

标签: robotframework

是否可以编写包含多个关键字的测试模板? 我正在寻找类似的东西:

Valid Login
    [Template]
    Given login page is open
    When ${username} and ${password} are inserted
    and user is on ${device}
    Then welcome page should be open
    root  abc  desktop
    noman  xyz  laptop

如果我可以使用列表而不是数据表

,那将是一个奖励

1 个答案:

答案 0 :(得分:3)

通常的方法是创建一个调用这些关键字的新关键字,并在设置中设置模板:

*** Settings ***

    Test template  Valid Login

*** Test cases ***

    root  abc  desktop
    noman  xyz  laptop

*** Keywords ***

Valid Login
    [Arguments]  ${username}  ${password}  ${device}
    Given login page is open
    When ${username} and ${password} are inserted
    and user is on ${device}
    Then welcome page should be open