如何在机器人框架中将Gherkin样式测试用例作为数据驱动?

时间:2014-11-11 08:56:53

标签: robotframework gherkin

我在Robot Framework中有一个Gherkin风格的测试用例。例如:

*** Settings ***
Documentation     Tests Login to website

Resource          ../keywords/resources.txt
Test Teardown     Close Browser   

*** Variables ***
${user}         demo
${userpass}     demo

*** Test Cases ***
Scenario: Login as a valid user to website
    Given Browser is opened to home page
    When I log in as ${user} with ${userpass}
    Then I can see page after sign in and verify
    And I will logout

有没有办法可以为多组数据运行相同的测试用例?

1 个答案:

答案 0 :(得分:1)

您应该只需将测试用例转换为关键字,然后将该关键字与Test Template功能一起使用即可。然后,您可以创建一整套排列。