일부 로봇 테스트 케이스가 디렉토리로 분리되어 있습니다. 디렉토리 계층 구조는 다음과 같습니다로봇 프레임 워크에서 다중 레벨 테스트 설정/분해 설정 방법
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으로 작성된 러너가 로봇 러너 모듈을 사용합니다.
==============================================================================
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
==============================================================================
보시다시피, 그것은 단지 최신 테스트 설치/해체를 실행 :이 명령 sudo python run.py --testsuit scenarios.ParentTestDirectory
으로 테스트 케이스를 실행의 결과입니다. 테스트 설치/부모 디렉토리에서 teardowns도 실행하고 그것은 아이의 전에 실행해야합니다. 다른 말로하면, 자신의 설정이되기 전에 각 테스트 케이스별로 상위 설정이 실행되기를 원합니다. 로봇 프레임 워크 기능으로이를 달성 할 수 있습니까?
모든 하위 테스트 사례가 시작되기 전에 상위 설정을 한 번만 실행 하시겠습니까? 그렇다면'__init __. robot'에서'Suite Setup'과'Suite Teardown'을 사용해보십시오. 또는 자체 설정 전에 각 테스트 케이스별로 상위 설정을 실행하고 싶습니까? –
@ A.Kootstra, 두 번째 추측은 사실입니다. 자체 설치 전에 각 테스트 케이스별로 상위 설정을 실행하고 싶습니다. –
두 번째 옵션을 찾고있는 경우 @Brian Oakley의 대답이 올바른 것입니다. –