当前位置:网站首页>Use case labeling mechanism of robot framework
Use case labeling mechanism of robot framework
2022-04-23 16:36:00 【Sink the wine cup and fleeting time】
RobotFramework And Use case labeling mechanism
Use case labeling mechanism
Force Tags
Two new robot file , adopt Force Tags keyword , stay test1.robot In the document Settings Label the watch , The label is called smokingtest
such , test1.robot All use cases in the file will be marked with smokingtest label
test1.robot
*** Settings ***
Force Tags smokingtest
*** Test Cases ***
Case1
log to console case1
Case2
log to console case2
test2.robot
*** Test Cases ***
Case3
log to console case1
Case4
log to console case2
Through the command robot --include smokingtest test*.robot, perform All with test start Of robot In file , belt smokingtest Use cases for tags
Only execution test1.robot In the document Case1 and Case2, because test2.robot In file Case3 and Case4 Use case no smokingtest label
[Tags]
stay robot In the document Test Cases Label the use cases in the table , The label is called tag1
test1.robot
*** Settings ***
Force Tags smokingtest
*** Test Cases ***
Case1
[Tags] tag1
log to console case1
Case2
log to console case2
test2.robot
*** Test Cases ***
Case3
[Tags] tag1
log to console case1
Case4
log to console case2
Through the command robot --include tag1 test*.robot, perform All with test start Of robot In file , belt tag1 Use cases for tags
Only execution test1.robot In the document Case1 and test2.robot Of documents Case3
A use case , You can put multiple labels
test1.robot
*** Settings ***
Force Tags smokingtest
*** Test Cases ***
Case1
[Tags] tag1 tag2
log to console case1
Case2
[Tags] tag2
log to console case2
test2.robot
*** Test Cases ***
Case3
[Tags] tag1 tag3
log to console case1
Case4
log to console case2
Through the command robot --include tag* test*.robot, perform All with test start Of robot In file , The tag name starts with tag The first use case
If you want to filter non tagged use cases , How to select ?
For example, above ,Case4 Just without any labels
Default Tags
Can be in Settings From the outside to the inside Default Tags keyword , Use cases that are not labeled , Put the default label
test1.robot
*** Settings ***
Force Tags smokingtest
Default Tags notags
*** Test Cases ***
Case1
[Tags] tag1 tag2
log to console case1
Case2
[Tags] tag2
log to console case2
test2.robot
*** Settings ***
Default Tags notags
*** Test Cases ***
Case3
[Tags] tag1 tag3
log to console case1
Case4
log to console case2
then , Through the command robot --include notags test*.robot, perform All with test start Of robot In file , The tag name is the default tag notags The use case
Now , Just execute Case4, That is, the use case with the tag name as the default tag
【 expand 】: If you want to edit all the files in the directory robot The documents are labeled , How to proceed ?
__init__.robot
stay test Under the folder , newly build __init__.robot file , adopt Force Tags keyword , stay __init__.robot In the document Settings Label the watch , The label is called default

*** Settings ***
Force Tags default
then , Through the command robot --include default test, perform test All under the folder robot In file , The tag name is the default tag default The use case
here ,test All under the folder robot In file , All use cases are executed
Select the test case according to the label
Execution includes label ‘tag1’ The use case
-- include tag1
Include at the same time label ‘tag1’ And labels ‘tag2’ The use case
-- include tag1ANDtag2
Include at the same time label ‘tag1’ And labels ‘tag test’ The use case
-- include tag1AND"tag test"
Execution does not include label ‘tag1’ The use case
-- exclude tag1
Execution includes label ‘tag1’ But it doesn't include labels ‘tag test’ The use case
-- include tag1OR"tag test"
The format of the execution label is ‘t*t’ The use case , Such as “test”
-- exclude t*t
Specify key test cases
If key test cases fail in this test , Then the whole test is regarded as a failure . conversely , The whole test is considered to have passed
By default ,RF When executing the test , Each test case is considered a key test case
You can use the parameter --critical or -c and --noncritical or -n Followed by tag name , To specify whether the test case is a key test case
--critical okSpecify that only haveokThe use case of the tag is the key use case--noncritical not_passThe specified does not havenot_passThe use case of the tag is the key use case , Other use cases are not critical use cases--critical ok* --noncritical not*Specifies that only the withokThe use case with the beginning tag , And not withnotThe use case of the beginning label , Is the key use case , Other use cases are not critical use cases
It is usually labeled in the main process use case
test.robot
*** Settings ***
Default Tags not_pass
*** Test Cases ***
Case1
[Tags] ok
log to console case1
Case2
should be true '123'=='1234'
Simulation here Case1 Main process use case ,Case2 Non critical use cases , Case1 Will execute pass , and Case2 Execution fails
In the report ,Case2 Although the execution failed , But the whole report still shows through , because Case2 Non critical use cases , Failed in time , It does not affect the results of the whole report
版权声明
本文为[Sink the wine cup and fleeting time]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231402128661.html
边栏推荐
- ESP32_ Arduino
- Detailed explanation of file operation (2)
- Real time operation of vim editor
- Nanny Anaconda installation tutorial
- 计组 | 【七 输入/输出系统】知识点与例题
- LVM与磁盘配额
- loggie 源码分析 source file 模块主干分析
- Gartner 发布新兴技术研究:深入洞悉元宇宙
- MySQL的btree索引和hash索引区别
- What does cloud disaster tolerance mean? What is the difference between cloud disaster tolerance and traditional disaster tolerance?
猜你喜欢

Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100
![[key points of final review of modern electronic assembly]](/img/17/007ca1f4fedd11ab878bddda3faf56.jpg)
[key points of final review of modern electronic assembly]

第十天 异常机制

JMeter installation tutorial and solutions to the problems I encountered

299. Number guessing game

Cartoon: what are IAAs, PAAS, SaaS?

Gartner predicts that the scale of cloud migration will increase significantly; What are the advantages of cloud migration?

How to upgrade openstack across versions

On the security of key passing and digital signature

Interview question 17.10 Main elements
随机推荐
ESXi封装网卡驱动
Introduction notes to PHP zero Foundation (13): array related functions
七朋元视界可信元宇宙社交体系满足多元化的消费以及社交需求
vim编辑器的实时操作
NVIDIA graphics card driver error
Use if else to judge in sail software - use the title condition to judge
Install MySQL on MAC
Report FCRA test question set and answers (11 wrong questions)
How magical is the unsafe class used by all major frameworks?
Redis "8" implements distributed current limiting and delay queues
RAID磁盘阵列与RAID5的创建
04 Lua 运算符
力扣-198.打家劫舍
Best practice of cloud migration in education industry: Haiyun Jiexun uses hypermotion cloud migration products to implement progressive migration for a university in Beijing, with a success rate of 1
NVIDIA显卡驱动报错
Force buckle-746 Climb stairs with minimum cost
On the value, breaking and harvest of NFT project
Qipengyuan horizon credible meta universe social system meets diversified consumption and social needs
Grbl learning (I)
Esxi encapsulated network card driver