Here are those Robot cases created by the trainees. They were not updated after I gave comments on drawbacks of each style, do NOT take as good examples of Robot cases.
Log In Test
Pair 1 :
Log In Test
| Setting | Value |
|---|---|
| Resource | resource.html |
| Test Case | Action | Argument | Argument |
|---|---|---|---|
| Valid Login | Open Login Page | ||
| Login As A User | demo | mode | |
| Page Should Be Welcome | |||
| Close Browser | |||
| Invalid Login | Open Login Page | ||
| Login As A User | demo | 1234 | |
| Page Should Be Error | |||
| Close Browser |
Robot Test Resources
| Setting | Value |
|---|---|
| Library | SeleniumLibrary |
| Variable | Value |
|---|---|
| ${BROWSER} | *firefox |
| ${username} | |
| ${password} | |
| ${Url} | |
| ${Title} | |
| ${HOST} | http://localhost:7272/ |
| ${Login Title} | Login Page |
| ${Welcome url} | ${HOST}welcome.html |
| ${Welcome title} | Welcome Page |
| ${Error url} | ${HOST}error.html |
| ${Error title} | Error Page |
| Keyword | Action | Argument | Argument |
|---|---|---|---|
| Page Should Be | [Arguments] | ${Url} | ${Title} |
| Location Should Be | ${Url} | ||
| Title Should Be | ${Title} | ||
| Open Login Page | Open Browser | ${HOST} | ${BROWSER} |
| Page Should Be Login | |||
| Login As a User | [Arguments] | ${username} | ${password} |
| Input Text | username_field | ${username} | |
| Input Text | password_field | ${password} | |
| Click Button | login_button | ||
| Page Should Be Welcome | Page Should Be | ${Welcome Url} | ${Welcome Title} |
| Page Should Be Error | Page Should Be | ${Error Url} | ${Error Title} |
| Page should be login | Page Should Be | ${HOST} | ${Login Title} |
Pair 2 :
Robot Test Cases
| Setting | Value |
|---|---|
| Library | Selenium Library |
| Variable | Value |
|---|---|
| ${Host} | localhost |
| ${Port} | 7272 |
| ${Welcome uRL} | http://${Host}:${Port}/welcome.html |
| ${Welcome Title} | Welcome Page |
| ${Login URL} | http://${Host}:${Port}/ |
| ${Login Title} | Login Page |
| ${Browser} | *iexplore |
| ${Error URL} | http://${Host}:${Port}/error.html |
| ${Error Title} | Error Page |
| Test Case | Action | Argument | Argument |
|---|---|---|---|
| Valid login | Login URL | dave | wibble |
| Show URL | ${Welcome Title} | ${Welcome URL} | |
| Invalid Login | Go To | ${Login URL} | |
| Login | demo | demo | |
| Show URL | ${Error Title} | ${Error URL} |
| Keyword | Action | Argument | Argument |
|---|---|---|---|
| Goto URL | [Arguments] | ${URL} | ${Browser} |
| Open Browser | ${URL} | ${Browser} | |
| Title Should Be | Login Page | ||
| Location Should Be | ${URL} | ||
| Login | [Arguments] | ${username} | ${password} |
| Input Text | username_field | ${username} | |
| Input Text | password_field | ${password} | |
| Click Button | login_button | ||
| Show URL | [Arguments] | ${Title} | ${URL} |
| Title Should Be | ${Title} | ||
| Location Should Be | ${URL} | ||
| Login URL | [Arguments] | ${username} | ${password} |
| Goto URL | ${Login URL} | ${Browser} | |
| Login | ${username} | ${password} |
Pair 3 :
Robot Test Cases
| Setting | Value |
|---|---|
| Library | SeleniumLibrary |
| Variable | Value |
|---|---|
| ${browser} | ie |
| ${server} | http://localhost:7272/ |
| ${welcome} | ${server}welcome.html |
| ${error} | ${server}error.html |
| ${user name} | demo |
| ${password} | mode |
| Test Case | Action | Argument | Argument |
|---|---|---|---|
| Valid Login | Go To Login Page | ||
| Input Text | username_field | demo | |
| Input Text | password_field | mode | |
| Click Button | login_button | ||
| Location Should Be | ${welcome} | ||
| Title Should Be | Welcome Page | ||
| Close Browser | |||
| Failed login | Go To Login Page | ||
| Input Text | username_field | MM | |
| Input Text | password_field | GG | |
| Go To Error Page | |||
| Go To Login Page | |||
| Input Text | username_field | demo | |
| Go To Error Page | |||
| Go To Login Page | |||
| Input Text | password_field | mode | |
| Go To Error Page |
| Keyword | Action | Argument | Argument |
|---|---|---|---|
| Go to login page | Open Browser | ${server} | ${browser} |
| Location Should Be | ${server} | ||
| Title Should Be | Login Page | ||
| Go to Error Page | Click Button | login_button | |
| Location Should Be | ${error} | ||
| Title Should Be | Error Page | ||
| Close Browser |
Pingback:robotframework Basic Training @090403 : test cases | Robot Framework中文站