2014年10月14日 星期二

robotframework demo 2 (selenium2library)

In  robotframework demo 1,  we define parameter.txt and key word.txt.  Follow those define, I desing  demo 2 to understand  Suite Setup、Suite Teardown 、Test Setup、Test Template

1. Create search_demo2 file

On Google_Demo, select this suite, right click on it and then click on New Suite

Enter  ->  search_demo2
Type ->   File
Format  ->  TXT

2. Edit search_demo2



 *** Settings ***
Suite Setup       Open Google web
Suite Teardown    Close Browser
Test Setup        Go to    ${Server}
Test Template     Input Search keyword
Resource          resource/keyword.txt

*** Test Cases ***    Keyword
keyword1              yahoo

keyword2              youtube

keyword3              python3

keyword4              ${KEYWORD}

keyword5              java

*** Keywords ***
Input Search keyword
    [Arguments]    ${key}
    Click Element    xpath=//*[@id="lst-ib"]
    Input Text    lst-ib    ${key}
    Press Key    xpath=//*[@id="lst-ib"]    \\27
    Click Button    xpath=//*[@id="tsf"]/div[2]/div[3]/center/input[1]
    Sleep    2


To Explain:

Suite Setup:  Start the test operation
Suite Teardown:   End the test operation
Test Setup:    Every test case start point
Test Template:   Every test case operation















3. Run search_demo2

沒有留言:

張貼留言