我在目录中分隔了一些机器人测试用例。目录层次结构是:
ParentTestDirectory
|__ ChidTestDirectoryOne
|__ TestOne.robot
|__ ChidTestDirectoryTwo
|__ TestTwo.robot
|__ __init__.robot
内容__init__.robot
:
*** Settings ***
Test Setup LOG TO CONSOLE Test setup from __init__.robot
Test Teardown LOG TO CONSOLE Test teardown from __init__.robot
内容TestOne.robot
:
*** Settings ***
Test Setup LOG TO CONSOLE Test setup from TestOne.robot
Test Teardown LOG TO CONSOLE Test teardown from TestOne.robot
*** Test Cases ***
Test One
LOG TO CONSOLE This is Test One!
内容TestTwo.robot
:
*** Settings ***
Test Setup LOG TO CONSOLE Test setup from TestTwo.robot
Test Teardown LOG TO CONSOLE Test teardown from TestTwo.robot
*** Test Cases ***
Test Two
LOG TO CONSOLE This is Test Two!
我有一个用 python 编写的跑步者,它使用机器人跑步者模块;这是使用命令运行测试用例的结果sudo python run.py --testsuit scenarios.ParentTestDirectory
:
==============================================================================
Scenarios
==============================================================================
Scenarios.ParentTestDirectory
==============================================================================
Scenarios.ParentTestDirectory.ChidTestDirectoryOne
==============================================================================
Scenarios.ParentTestDirectory.ChidTestDirectoryOne.TestOne
==============================================================================
Test One Test setup from TestOne.robot
.This is Test One!
.Test teardown from TestOne.robot
Test One | PASS |
------------------------------------------------------------------------------
Scenarios.ParentTestDirectory.ChidTestDirectoryOne.TestOne | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Scenarios.ParentTestDirectory.ChidTestDirectoryOne | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Scenarios.ParentTestDirectory.ChidTestDirectoryTwo
==============================================================================
Scenarios.ParentTestDirectory.ChidTestDirectoryTwo.TestTwo
==============================================================================
Test Two Test setup from TestTwo.robot
.This is Test Two!
.Test teardown from TestTwo.robot
Test Two | PASS |
------------------------------------------------------------------------------
Scenarios.ParentTestDirectory.ChidTestDirectoryTwo.TestTwo | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Scenarios.ParentTestDirectory.ChidTestDirectoryTwo | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Scenarios.ParentTestDirectory | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
Scenarios | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
如您所见,它只是运行最新的测试设置/拆卸。我希望它也可以从父目录运行测试设置/拆卸,它应该在子目录之前执行。换句话说,我希望在每个测试用例自己的设置之前分别运行父设置。我可以通过机器人框架功能实现这一点吗?