我应该使用强制标签还是默认标签
Should I use Force Tags or Default Tags
我想利用标签记录测试用例中的缺陷ID。
这样我就可以运行特定的测试用例,很容易出现缺陷。
根据用户指南,例如,设置中有强制标签和默认标签。对于我的情况,我应该使用哪一个? :
*** 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
,那么您可以在设置中使用 Force Tags 或在测试本身中使用 [Tags]。
Default Tags
在这种情况下不合适,因为如果在测试中定义了其他标签,您将承担某些测试无法获得 Defect1
标签的风险。
所以我会说两种可能性是:
[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
- 使用
[Force Tags]
(方便,因为您不必在每次测试中重复标记)
*** 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
我想利用标签记录测试用例中的缺陷ID。 这样我就可以运行特定的测试用例,很容易出现缺陷。
根据用户指南,例如,设置中有强制标签和默认标签。对于我的情况,我应该使用哪一个? :
*** 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
,那么您可以在设置中使用 Force Tags 或在测试本身中使用 [Tags]。
Default Tags
在这种情况下不合适,因为如果在测试中定义了其他标签,您将承担某些测试无法获得 Defect1
标签的风险。
所以我会说两种可能性是:
[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
- 使用
[Force Tags]
(方便,因为您不必在每次测试中重复标记)
*** 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