当前位置:网站首页>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
边栏推荐
- 英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
- Day (6) of picking up matlab
- MySQL personal learning summary
- 100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
- Day 9 static abstract class interface
- NVIDIA显卡驱动报错
- File system read and write performance test practice
- 深度学习100例 | 第41天-卷积神经网络(CNN):UrbanSound8K音频分类(语音识别)
- Database dbvisualizer Pro reported file error, resulting in data connection failure
- 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
猜你喜欢

LVM and disk quota

MySql主从复制

如何建立 TikTok用户信任并拉动粉丝增长

昆腾全双工数字无线收发芯片KT1605/KT1606/KT1607/KT1608适用对讲机方案

Review 2021: how to help customers clear the obstacles in the last mile of going to the cloud?

Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed

Cartoon: what are IAAs, PAAS, SaaS?

OMNeT学习之新建工程

NVIDIA显卡驱动报错

无线鹅颈麦主播麦手持麦无线麦克风方案应当如何选择
随机推荐
05 Lua control structure
Es common query, sorting and aggregation statements
Postman batch production body information (realize batch modification of data)
Introduction notes to PHP zero Foundation (13): array related functions
英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
Start Oracle service on Linux
JMeter installation tutorial and solutions to the problems I encountered
Review 2021: how to help customers clear the obstacles in the last mile of going to the cloud?
Countdown 1 day ~ 2022 online conference of cloud disaster tolerance products is about to begin
最詳細的背包問題!!!
What is homebrew? And use
The most detailed Backpack issues!!!
logback的配置文件加载顺序
Matplotlib tutorial 05 --- operating images
昆腾全双工数字无线收发芯片KT1605/KT1606/KT1607/KT1608适用对讲机方案
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
Hyperbdr cloud disaster recovery v3 Version 2.1 release supports more cloud platforms and adds monitoring and alarm functions
Detailed explanation of file operation (2)
Gartner predicts that the scale of cloud migration will increase significantly; What are the advantages of cloud migration?
Day (5) of picking up matlab