我有一个测试套件,其中包含5个测试,并结合了如下所示的不同测试标签
*** Settings ***
Test Setup Perform Test Setup
*** Test Cases ***
TC1
[Tags] preprod
log to console preprod tests : test1
TC2
[Tags] Debug
log to console debug tests : test2
TC3
[Tags] preprod Debug
log to console debug and prerod : test3
*** Keywords ***
Perform Test Setup
log to console Test Cases With Tag To Run Are : @{TEST TAGS}
Run Keyword If 'Debug' in ${TEST TAGS}
... log to console Debug Test Starting
Run Keyword If 'preprod' in ${TEST TAGS}
... log to console preprod tests starting
现在,当我使用标签运行以下命令
robot -i preprod sample.robot
即使条件hpt的“执行测试设置”中的关键字正在运行。
=============================================================================
Sample
==============================================================================
TC1 Test Cases With Tag To Run Are : ['preprod']
preprod tests starting
.preprod tests : test1
TC1 | PASS |
------------------------------------------------------------------------------
TC3 Test Cases With Tag To Run Are : ['Debug', 'preprod']
Debug Test Starting
preprod tests starting
.debug and prerod : test3
TC3 | PASS |
------------------------------------------------------------------------------
Sample | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
在“执行测试设置”条件下提供'Debug' == ${TEST TAGS}
时,关键字根本不会执行。
如何基于在测试中具有多个标签和组合的标签运行Test Suite设置或TearDown