我想利用标签来记下测试用例中的缺陷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-*
Run Code Online (Sandbox Code Playgroud)
我的测试用例写在一个文件中并设置为测试套件,缺陷出现在这两种情况的步骤之一,这是正确的设置吗?:
*** 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
Run Code Online (Sandbox Code Playgroud)
如果您希望两个测试都获取标签,Defect1那么您可以在“设置”中使用“强制标签”,或者在测试本身中使用“[标签]”。
Default TagsDefect1在这种情况下是不合适的,因为如果在测试中定义了其他标签,您将面临某些测试无法获取该标签的风险。
所以我想说两种可能性是:
[Tags](很方便,因为在查看测试时您可以直接看到它具有标签)Run Code Online (Sandbox Code Playgroud)*** 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](方便,因为您不必在每次测试中重复标记)Run Code Online (Sandbox Code Playgroud)*** 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
| 归档时间: |
|
| 查看次数: |
3583 次 |
| 最近记录: |