如何在机器人框架中标记数据驱动的模板测试
How to Tag Data Driven Template Tests in Robot Framework
我有许多数据驱动的测试,因此我可以 运行 使用多行数据进行相同的测试,效果很好。但是,我们也使用 TestRail 和 link RF 测试,通过 RF 测试上的 Tag 来测试 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 标签。如何为上面示例中的每个数据行添加标签?
一个简单的解决方案是修改模板以接受标记作为参数之一,然后在关键字中调用 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
我有许多数据驱动的测试,因此我可以 运行 使用多行数据进行相同的测试,效果很好。但是,我们也使用 TestRail 和 link RF 测试,通过 RF 测试上的 Tag 来测试 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 标签。如何为上面示例中的每个数据行添加标签?
一个简单的解决方案是修改模板以接受标记作为参数之一,然后在关键字中调用 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