当前位置:网站首页>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
边栏推荐
- Database dbvisualizer Pro reported file error, resulting in data connection failure
- Interview question 17.10 Main elements
- Passing header request header information between services through feign
- Server log analysis tool (identify, extract, merge, and count exception information)
- JSP learning 3
- 安装Redis并部署Redis高可用集群
- loggie 源码分析 source file 模块主干分析
- Set cell filling and ranking method according to the size of the value in the soft report
- What is homebrew? And use
- What is the experience of using prophet, an open source research tool?
猜你喜欢

Day (5) of picking up matlab

Use itextpdf to intercept the page to page of PDF document and divide it into pieces

Day 10 abnormal mechanism

力扣-198.打家劫舍

NVIDIA graphics card driver error

【Pygame小游戏】10年前风靡全球的手游《愤怒的小鸟》,是如何霸榜的?经典回归......

Gartner 發布新興技術研究:深入洞悉元宇宙
![[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return](/img/f5/15b3731e75eb4d861bd9d29ae244da.png)
[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return

Change the icon size of PLSQL toolbar

Detailed explanation of file operation (2)
随机推荐
Database dbvisualizer Pro reported file error, resulting in data connection failure
05 Lua control structure
Introduction notes to PHP zero Foundation (13): array related functions
Sort by character occurrence frequency 451
Gartner publie une étude sur les nouvelles technologies: un aperçu du métacosme
Creation of RAID disk array and RAID5
OAK-D树莓派点云项目【附详细代码】
Day 10 abnormal mechanism
05 Lua 控制结构
Oak-d raspberry pie cloud project [with detailed code]
MySql主从复制
JSP learning 2
Oracle data pump usage
DanceNN:字节自研千亿级规模文件元数据存储系统概述
Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed
力扣-198.打家劫舍
04 Lua operator
Sail soft implements a radio button, which can uniformly set the selection status of other radio buttons
Hyperbdr cloud disaster recovery v3 Release of version 3.0 | upgrade of disaster recovery function and optimization of resource group management function
linux上启动oracle服务