【问题标题】:How to Tag Data Driven Template Tests in Robot Framework如何在 Robot Framework 中标记数据驱动的模板测试
【发布时间】:2018-02-05 20:44:34
【问题描述】:

我有大量的数据驱动测试,因此我可以使用多行数据运行相同的测试,效果很好。但是,我们也使用 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 的唯一标记。上例中如何为每个数据行添加标签?

【问题讨论】:

    标签: tags robotframework testrail


    【解决方案1】:

    一个简单的解决方案是修改您的模板以接受标签作为参数之一,然后在您的关键字中调用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
    

    【讨论】:

    • 嗨。我尝试对此进行测试,发生的情况是,如果其中一个场景失败,即使其他两个确实成功,所有标签都会记录为失败。有解决办法吗?
    • @MKSpan:可能没有解决办法;标签与测试用例相关联,而不是与测试的各个部分相关联。
    猜你喜欢
    • 1970-01-01
    • 2014-04-14
    • 2014-10-01
    • 2019-04-03
    • 1970-01-01
    • 2017-05-08
    • 2013-03-18
    • 2021-12-12
    • 2013-09-24
    相关资源
    最近更新 更多