'robot test get tabke'에 해당되는 글 1건

  1. 2018.09.24 Robot framework 을 사용한 web page 테스트

Robot framework 을 사용한 web page 테스트

  1. Prerequired

    • 관련 파이썬 라이브러리 설치
      # pip install --upgrade robotframework
      # pip install --upgrade robotframework-selenium2library
      
    • selenium 을 통해 webdriver 를 호출하기 위한 브라우저 모듈 설치
  2. Robot test 실행

     $ python -m robot.run {{실행파일}}
    
    • 실행 결과 를 xml 파일로 남긴다
      • output.xml
      • log.html
      • report.html
    • 예시
        MrSense:input mr.sense$ python -m robot.run input.robot
        ==============================================================================
        Input
        ==============================================================================
        Basic Test                                                            | PASS |
        ------------------------------------------------------------------------------
        Input                                                                 | PASS |
        1 critical test, 1 passed, 0 failed
        1 test total, 1 passed, 0 failed
        ==============================================================================
        Output:  /Users/mr.sense/Dev/robotframework/sample.code/robotframework/input/output.xml
        Log:     /Users/mr.sense/Dev/robotframework/sample.code/robotframework/input/log.html
        Report:  /Users/mr.sense/Dev/robotframework/sample.code/robotframework/input/report.html
      
  3. Input Tag 관련 테스트 파일

     *** Settings ***
     Library           Selenium2Library
    
     *** Test Cases ***
     Basic Test
         Open Html
         Insert Text To Input Field
         Insert File To Input Field
         Click The button
    
     *** Keywords ***
     Open Html
         Open Browser    http://localhost:8000/input.html   browser=chrome
         Maximize Browser Window
    
     Insert Text To Input Field
         Input Text    input-text    hello world
    
     Insert File To Input Field
         Choose File   input-file  /Users/mr.sense/Dev/input.html
    
     Click The button
         Click Element     input-button
    
  4. Click Event 관련 테스트 파일

     *** Settings ***
     Library           Selenium2Library
    
     *** Test Cases ***
     Basic Test
         Open Html
         Click The button
         Click The Selectbox
         Click The link
    
     *** Keywords ***
     Open Html
         Open Browser    http://localhost:8000/click.html   browser=chrome
         Maximize Browser Window
    
     Click The button
         Click Element     btn-click
    
     Click The Selectbox
         Select From List by Value    xpath=//select[@id="select-click"]    third
         Element Should Contain    select-click    third
    
     Click The link
         Click Link      /a.html
         Wait Until Page Contains    HIHIHI    2s
    
  5. Table 관련 테스트 파일 (id 없는 element 다루기)

     *** Settings ***
     Library           Selenium2Library
    
     *** Test Cases ***
     Basic Test
         Open Html
         Get Table Row Count
         Get Table Td text
    
     *** Keywords ***
     Open Html
         Open Browser    http://localhost:8000/table.html   browser=chrome
         Maximize Browser Window
    
     Get Table Row Count
         Assign Id To Element    xpath=//table[@class="xtable"]    my_table
         ${rowCount}=    Get Matching Xpath Count       .//table[@id="my_table"]/tbody/tr
         shouldBeEqualAsIntegers     3    ${rowCount}
    
     Get Table Td text
         Assign Id To Element    xpath=//table[@class="xtable"]    my_table
         ${cellValue}=  Get Table Cell    my_table   2   2
         shouldBeEqual  19  ${cellValue}


Posted by 감각적신사
,