当前位置:网站首页>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 ok
Specify that only haveok
The use case of the tag is the key use case--noncritical not_pass
The specified does not havenot_pass
The 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 withok
The use case with the beginning tag , And not withnot
The 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
边栏推荐
- 阿里研发三面,面试官一套组合拳让我当场懵逼
- JMeter setting environment variable supports direct startup by entering JMeter in any terminal directory
- What does cloud disaster tolerance mean? What is the difference between cloud disaster tolerance and traditional disaster tolerance?
- Flask如何在内存中缓存数据?
- 七朋元视界可信元宇宙社交体系满足多元化的消费以及社交需求
- 关于局域网如何组建介绍
- Six scenarios of cloud migration
- The most detailed knapsack problem!!!
- 面试题 17.10. 主要元素
- The solution of not displaying a whole line when the total value needs to be set to 0 in sail software
猜你喜欢
MySql主从复制
Nanny Anaconda installation tutorial
The solution of not displaying a whole line when the total value needs to be set to 0 in sail software
欣旺达:HEV和BEV超快充拳头产品大规模出货
How magical is the unsafe class used by all major frameworks?
第十天 异常机制
力扣-198.打家劫舍
Force buckle-746 Climb stairs with minimum cost
人脸识别框架之dlib
Change the icon size of PLSQL toolbar
随机推荐
欣旺达:HEV和BEV超快充拳头产品大规模出货
LVM与磁盘配额
On the security of key passing and digital signature
On the value, breaking and harvest of NFT project
英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
Install MySQL on MAC
Download and install mongodb
How to upgrade openstack across versions
Oak-d raspberry pie cloud project [with detailed code]
NVIDIA显卡驱动报错
JSP learning 3
伪分布安装spark
如何进行应用安全测试(AST)
MySQL personal learning summary
Nacos 详解,有点东西
ES常用查询、排序、聚合语句
Government cloud migration practice: Beiming digital division used hypermotion cloud migration products to implement the cloud migration project for a government unit, and completed the migration of n
Introduction notes to PHP zero Foundation (13): array related functions
Review 2021: how to help customers clear the obstacles in the last mile of going to the cloud?
Use if else to judge in sail software - use the title condition to judge