Robotframework 我应该使用强制标记还是默认标记
我想利用标签记录测试用例中的缺陷ID。 这样我就可以运行容易出现缺陷的特定测试用例 例如,在《用户指南》中的“设置”中有“强制标记”和“默认标记”。对于我的情况,我应该使用哪一个Robotframework 我应该使用强制标记还是默认标记,robotframework,Robotframework,我想利用标签记录测试用例中的缺陷ID。 这样我就可以运行容易出现缺陷的特定测试用例 例如,在《用户指南》中的“设置”中有“强制标记”和“默认标记”。对于我的情况,我应该使用哪一个 *** Settings *** Force Tags req-42 Default Tags owner-john smoke *** Variables *** ${HOST} 10.0.1.42 *** Test Cases *** No own tags [Do
*** Settings ***
Force Tags req-42
Default Tags owner-john smoke
*** Variables ***
${HOST} 10.0.1.42
*** Test Cases ***
No own tags
[Documentation] This test has tags owner-john, smoke and req-42.
No Operation
With own tags
[Documentation] This test has tags not_ready, owner-mrx and req-42.
[Tags] owner-mrx not_ready
No Operation
Own tags with variables
[Documentation] This test has tags host-10.0.1.42 and req-42.
[Tags] host-${HOST}
No Operation
Empty own tags
[Documentation] This test has only tag req-42.
[Tags]
No Operation
Set Tags and Remove Tags Keywords
[Documentation] This test has tags mytag and owner-john.
Set Tags mytag
Remove Tags smoke req-*
我的测试用例写在一个文件中,并设置为测试套件,缺陷出现在两种情况下的一个步骤中,这是正确的设置吗
*** Settings ***
Resource ../Resources/res.robot
Suite Setup Suite Setup Suite
Test Setup Test Setup
Suite Teardown Test Teardown
Default Tags Defect1
*** Test Cases ***
TC001-001-01
[Tags] Defect1
Go To Page 1
Go Back
TC001-001-02
[Tags] Defect1
Go To Page 2
Go Back
如果您希望两个测试都获得标签
Defect1
,则可以在设置中使用强制标签,也可以在测试本身中使用[Tags]
默认标记
在这种情况下是不合适的,因为如果在测试中定义了其他标记,您将承担某些测试没有获得Defect1
标记的风险
因此,我认为有两种可能性:
[Tags]
(非常方便,因为您在查看测试时可以直接看到它有标签)[Force Tags]
(方便,因为您不必在每次测试中重复标记)*** Settings ***
Resource ../Resources/res.robot
Suite Setup Suite Setup Suite
Test Setup Test Setup
Suite Teardown Test Teardown
*** Test Cases ***
TC001-001-01
[Tags] Defect1
Go To Page 1
Go Back
TC001-001-02
[Tags] Defect1
Go To Page 2
Go Back
*** Settings ***
Resource ../Resources/res.robot
Suite Setup Suite Setup Suite
Test Setup Test Setup
Suite Teardown Test Teardown
Force Tags Defect1
*** Test Cases ***
TC001-001-01
Go To Page 1
Go Back
TC001-001-02
Go To Page 2
Go Back