robotframework Basic Training @090403 : test cases

原帖地址:http://kaverjody.com/robotframework-basic-training-090403-test-cases/

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.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

 

robotframework Basic Training by ME

原帖地址:http://kaverjody.com/robotframework-basic-training-by-me/

Went through the theory part quickly, introducing that “Acceptance Testing” is our focus area in this course, also robotframework is designed for this area. Then explained different levels/types of test automation, frameworks for test automation, then robotframework.

Shortly we moved to familiar with the system under test, a very simple web application. On a login page, you enter username and password, if it’s correct you got a welcome page; if it’s wrong, you got an error page. You could logout of course.

After that, I separated all the trainees (8 people) into two groups with 4 people in each, there are both developer and tester background people which is nice. Ask them to do test planning within the group, “what would be your testcases to verify the system under test?”

One interesting thing I found gradually is different groups made different plan / testcases for the same system under test. These two groups were different too.

Then they were asked to select their first testcase from the list, and form into pairs (one former group forms two pairs, working on the same testcase within group). Unlike the trainings I gave in the past, I almost gave no introduction beforehand, e.g. how to write testcase, how to run it, how to find a keyword, how to import a library, and more. But just let them go, rely on the pair to find the answer by their own.

They worked out the 1st testcase very fast, some even made user keywords already. Obviously they had problem with keyword abstraction, executable documents, duplication in variable and keyword, etc. Find out commonnesses and differences among those testcases can lead them to the right direction, and visible charts or texts would help.

Before reaching that, I asked them to summarize the 1st Robot testcase on to paper. “Consider your experience in the past, normally we design the testcase and write down the document, then you or other testers will execute the tests according to the document.”, “now, within your group, document the testcase which you just implemented.”

After finished summarization, they had to select another testcase, discuss and write it down on paper.

While each group had two documented testcases, and the list of testcases, I asked them to paste those flipcharts on the wall together, one next to another, so it’s easy to see the same / differ parts of testcases. Still, discussing within group, find out those parts could be reused or shared by other testcases.

Groups made a bit progress, instead of directing the training (I may wish to call it a workshop now) too much, I defined the target for that session — “while concluded, come back to pairs and implement the 2nd testcase, or more if you wish. Besides that, consider the overall test management, do you best to reduce duplication, ease future maintenance and so on.”

This session took nearly 2 hours, and it could be more since they had some urgent things to do. They actively browse the http://robotframework.org website for all the information they need, me and ZGC (co-trainer) were helpping around if they had questions.

They used the glass board for drawing, updating and recording their discussion.

During this session, I found one group updated their orginal testcase document, seems added some comments regarding the abstracted higher level user keywords and some other stuff.

Again, while all pairs made their 2nd testcase, they shared with the rest via projector. In order to be fast, and providing direct feedback, I commented right after they showed their testcase, point out the problems and risks, the ways to correct those, possible improvement actions, and why it’s better.

Then it came to the Q&A session. One good question was “how to map the ‘detailed view of the framework’ to all we just did”. The “detailed view of the framework” slide in the training material illustrated all activities happened from designing a testcase until test report is ok, but it’s abstract, conceptual, a kind of logical view. The trainees want to understand it from the experience just happened.

I pasted a new flipchart, drew those panes on the paper, explained each step in the whole procedure, and fill them gradually on the paper. Then finally the flipchart became as below :