2

我有大量的数据驱动测试,因此我可以使用多行数据运行相同的测试,效果很好。但是,我们也使用 TestRail 并通过 RF 测试上的标签将 RF 测试链接到 TestRail。目前我只为每个模板标记一个 TestRailID。例如:

*** Test Cases ***
Verify Registering For An Event with each CC Type
  [Template]  Register For An Event with a Credit Card
  [Tags]    TestRailID=1211  Smoke    
  ${cc_intl}   ${personInfo}  ${visaCardInfo}
  ${cc_intl}   ${personInfo}  ${masterCardInfo}
  ${cc_intl}   ${personInfo}  ${americanCardInfo}
  #etc

我希望每一行数据都有一个用于 TestRailID 的唯一标签。如何在上面的示例中为每个数据行添加标签?

4

1 回答 1

6

一种简单的解决方案是修改模板以接受标签作为参数之一,然后在关键字中调用set tags 。

例子:

*** Keywords ***
Register For An Event with a Credit Card
    [Arguments]  ${tag}  ${personInfo}  ${cardInfo}
    set tags  ${tag}
    log  personInfo: ${personInfo} cardInfo: ${cardInfo}

*** Test Cases ***
Verify Registering For An Event with each CC Type
  [Template]  Register For An Event with a Credit Card
  [Tags]    TestRailID=1211  Smoke    
  TestRailID=1  person one    visa
  TestRailID=2  person two    mastercard
  TestRailID=3  person three  american express
于 2018-02-05T21:01:02.667 回答