如何在 Robot Framework 中标记数据驱动的模板测试 [英] How to Tag Data Driven Template Tests in Robot Framework

查看:59
本文介绍了如何在 Robot Framework 中标记数据驱动的模板测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have numerous data driven tests so that I can run the same test with multiple rows of data, which works well. However, we also use TestRail and link RF tests to TestRail via a Tag on the RF test. Currently I'm only tagging one TestRailID per template. Eg:

*** 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 标签.如何为上述示例中的每个数据行添加标签?

I would like each row of data to have a unique tag for the TestRailID. How can I add a tag for each data row in the above example?

推荐答案

一个简单的解决方案是修改你的模板以接受一个标签作为参数之一,然后调用 在您的关键字中设置标签.

One simple solution would be to modify your template to accept a tag as one of the arguments, then call set tags within your keyword.

示例:

*** 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

这篇关于如何在 Robot Framework 中标记数据驱动的模板测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆