Robot Framework 사용해보기①
5708 단어 centos7robotframework
배경
네트워크 기기의 시험 자동화를 향해 할 수밖에 없었다.
robotframework를 선택한 것은 일본어 문서가 많을 것이라고, 리포트가 깨끗하기 때문에.
환경
VPS에 centos와 vyos의 Docker 컨테이너를 만들고 centos에 robotframework를 설치하십시오.
하고 싶은 일
VPS에 centos와 vyos의 Docker 컨테이너를 만들고 centos에 robotframework를 설치하십시오.
하고 싶은 일
처음 한 걸음
우선, ssh 접속하지 않으면 아무것도 할 수 없을 것 같기 때문에 여러가지 보면서 해 본다.
SSH 연결로 기본 설명 확인
test00.robot*** Settings ***
Library SSHLibrary
*** Test Cases ***
ssh test
Open Connection 172.17.0.2
Login vyos vyos
${output} = Execute Command echo SSH is succeeded!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH is succeeded!
Close All Connections
result of test00.robot# robot test00.robot
==============================================================================
Test00
==============================================================================
ssh test ...
SSH is succeeded!
ssh test | PASS |
------------------------------------------------------------------------------
Test00 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output: /root/output.xml
Log: /root/log.html
Report: /root/report.html
#
10행 정도로 기대 동작을 해 주었다.
변수 테이블을 정의하는 것이 좋습니다.
test01.robot*** Settings ***
Library SSHLibrary
*** Variables ***
${user} vyos
${password} vyos
${ip1} 172.17.0.2
${ip2} 172.17.0.3
*** Test Cases ***
ssh test of vyos
Open Connection ${ip1}
Login ${user} ${password}
${output} = Execute Command echo SSH to vyos is OK!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH to vyos is OK!
Close All Connections
ssh test of vyos2
Open Connection ${ip2}
Login ${user} ${password}
${output} = Execute Command echo SSH to vyos2 is OK!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH to vyos2 is OK!
Close All Connections
result of test01.robot# robot test01.robot
==============================================================================
Test01
==============================================================================
ssh test of vyos ...
SSH to vyos is OK!
ssh test of vyos | PASS |
------------------------------------------------------------------------------
ssh test of vyos2 ...
SSH to vyos2 is OK!
ssh test of vyos2 | PASS |
------------------------------------------------------------------------------
Test01 | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
Output: /root/output.xml
Log: /root/log.html
Report: /root/report.html
*** Variables *** 에서 스칼라 변수를 정의하기만 하면 됩니다.
log.html도 보기 쉽다.
키워드를 정의 할 수있는 것 같습니다.
test02.robot*** Settings ***
Library SSHLibrary
*** Variables ***
${user} vyos
${password} vyos
${ip1} 172.17.0.2
${ip2} 172.17.0.3
*** Test Cases ***
ssh test of vyos
vyosに接続
vyosにログイン
${output} = Execute Command echo SSH to vyos is OK!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH to vyos is OK!
Close All Connections
ssh test of vyos2
Open Connection ${ip2}
Login ${user} ${password}
${output} = Execute Command echo SSH to vyos2 is OK!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH to vyos2 is OK!
Close All Connections
*** Keywords ***
vyosに接続
Open Connection ${ip1}
vyosにログイン
Login ${user} ${password}
result of test02.robot# robot test02.robot
==============================================================================
Test02
==============================================================================
ssh test of vyos ...
SSH to vyos is OK!
ssh test of vyos | PASS |
------------------------------------------------------------------------------
ssh test of vyos2 ...
SSH to vyos2 is OK!
ssh test of vyos2 | PASS |
------------------------------------------------------------------------------
Test02 | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
Output: /root/output.xml
Log: /root/log.html
Report: /root/report.html
#
다음 번에는 원격 호스트에서 명령 실행을 시도합시다.
Reference
이 문제에 관하여(Robot Framework 사용해보기①), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/navasato/items/862b7715595319a63239
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
*** Settings ***
Library SSHLibrary
*** Test Cases ***
ssh test
Open Connection 172.17.0.2
Login vyos vyos
${output} = Execute Command echo SSH is succeeded!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH is succeeded!
Close All Connections
# robot test00.robot
==============================================================================
Test00
==============================================================================
ssh test ...
SSH is succeeded!
ssh test | PASS |
------------------------------------------------------------------------------
Test00 | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output: /root/output.xml
Log: /root/log.html
Report: /root/report.html
#
*** Settings ***
Library SSHLibrary
*** Variables ***
${user} vyos
${password} vyos
${ip1} 172.17.0.2
${ip2} 172.17.0.3
*** Test Cases ***
ssh test of vyos
Open Connection ${ip1}
Login ${user} ${password}
${output} = Execute Command echo SSH to vyos is OK!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH to vyos is OK!
Close All Connections
ssh test of vyos2
Open Connection ${ip2}
Login ${user} ${password}
${output} = Execute Command echo SSH to vyos2 is OK!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH to vyos2 is OK!
Close All Connections
# robot test01.robot
==============================================================================
Test01
==============================================================================
ssh test of vyos ...
SSH to vyos is OK!
ssh test of vyos | PASS |
------------------------------------------------------------------------------
ssh test of vyos2 ...
SSH to vyos2 is OK!
ssh test of vyos2 | PASS |
------------------------------------------------------------------------------
Test01 | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
Output: /root/output.xml
Log: /root/log.html
Report: /root/report.html
*** Settings ***
Library SSHLibrary
*** Variables ***
${user} vyos
${password} vyos
${ip1} 172.17.0.2
${ip2} 172.17.0.3
*** Test Cases ***
ssh test of vyos
vyosに接続
vyosにログイン
${output} = Execute Command echo SSH to vyos is OK!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH to vyos is OK!
Close All Connections
ssh test of vyos2
Open Connection ${ip2}
Login ${user} ${password}
${output} = Execute Command echo SSH to vyos2 is OK!
Log To Console ${\n}${output}
Should Be Equal ${output} SSH to vyos2 is OK!
Close All Connections
*** Keywords ***
vyosに接続
Open Connection ${ip1}
vyosにログイン
Login ${user} ${password}
# robot test02.robot
==============================================================================
Test02
==============================================================================
ssh test of vyos ...
SSH to vyos is OK!
ssh test of vyos | PASS |
------------------------------------------------------------------------------
ssh test of vyos2 ...
SSH to vyos2 is OK!
ssh test of vyos2 | PASS |
------------------------------------------------------------------------------
Test02 | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
Output: /root/output.xml
Log: /root/log.html
Report: /root/report.html
#
Reference
이 문제에 관하여(Robot Framework 사용해보기①), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/navasato/items/862b7715595319a63239텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)