RF中在测试用例集上设置标签

1.有时候我们在执行测试用例时只想执行部分测试用例集下面的测试用例,这时可以在相应的测试用例集中设置标签,然后运行时选择标签执行对应的测试用例

语法:

*** Settings ***
Force Tags  tagname

2.示例
*** Settings ***
Library  api.checkin
Variables  config/cfg.py
Force Tags  old    #设置测试用例集的标签,代表用例集下面的每个测试用例都拥有这个标签

*** Test Cases ***

事中门诊入参校验-缺少字段
    compareResult  ${checkin_path_old_2}  201  4.0a

事中门诊入参校验-多余字段
    compareResult  ${checkin_path_old_1}  201  4.0a

事中门诊入参校验-空字段
    compareResult  ${checkin_path_old_4}  201  4.0a

事中门诊入参校验-字段格式有误
    compareResult  ${checkin_path_old_3}  201  4.0a

事中门诊入参校验-字段长度超长
    compareResult  ${checkin_path_old_5}  201  4.0a

事中门诊入参校验-业务值
    compareResult  ${checkin_path_old_6}  201  4.0a

事中门诊入参校验-不完整的XML
    compareResult  ${checkin_path_old_error}  201  4.0a

事中门诊入参校验-正常的XML
    compareResult  ${checkin_path_old_0}  201  4.0a

命令行运行:

C:\Users\cale\checkapi>robot --pythonpath ./ --include old test
==============================================================================
Test
==============================================================================
Test.Checkin Opt Old
==============================================================================
事中门诊入参校验-缺少字段                                             | PASS |
------------------------------------------------------------------------------
事中门诊入参校验-多余字段                                             | PASS |
------------------------------------------------------------------------------
事中门诊入参校验-空字段                                               | PASS |
------------------------------------------------------------------------------
事中门诊入参校验-字段格式有误                                         | PASS |
------------------------------------------------------------------------------
事中门诊入参校验-字段长度超长                                         | PASS |
------------------------------------------------------------------------------
事中门诊入参校验-业务值                                               | PASS |
------------------------------------------------------------------------------
事中门诊入参校验-不完整的XML                                          | PASS |
------------------------------------------------------------------------------
事中门诊入参校验-正常的XML                                            | PASS |
------------------------------------------------------------------------------
Test.Checkin Opt Old                                                  | PASS |
8 critical tests, 8 passed, 0 failed
8 tests total, 8 passed, 0 failed
==============================================================================
Test                                                                  | PASS |
8 critical tests, 8 passed, 0 failed
8 tests total, 8 passed, 0 failed
==============================================================================
Output:  C:\Users\cale\checkapi\output.xml
Log:     C:\Users\cale\checkapi\log.html
Report:  C:\Users\cale\checkapi\report.html

 完整的标签设置场景参考:https://www.cnblogs.com/peipei-Study/archive/2019/12/24/12084382.html

posted @ 2020-04-17 16:49  pple  阅读(540)  评论(0编辑  收藏  举报
以终为始,你期待的那天不会太遥远。