Friday, 28 December 2012

How to write test cases in Ride


This section includes how to write test cases in Ride :-

The Robot Framework IDE (RIDE) is the integrated development environment to implement automated tests and it is a generic test automation framework for acceptance testing.

Pre-requisite :- Ride should be installed.

To install ride steps are :-
1.install python in ur disk drive.(python-2.7.1)
2.Set these two env variables 

PYTHONHOME = C:\Python27
PYTHONPATH = C:\Python27\Lib;C:\Python27\Scripts;C:\Python27\Lib\site-packages;C:\Python27\Lib\site-packages\Selenium2Library;C:\Python27\Lib\site-packages\robotide\;C:\Python27\Lib\site-packages\robot\;C:\Python27\Lib\site-packages\wx-2.8-msw-unicode;C:\Python27\Lib\site-packages\SampleLibrary

and also Add this to path
path =;%PYTHONHOME%;%PYTHONHOME%\Scripts


3. install setup tools (setuptools-0.6c11.win32-py2.7)
4. easy_install robotframework (robotframework-ride-0.49.win32)
5. easy_install robotframework-selenium2library(robotframework-seleniumlibrary-2.7.win32.exe)
6. install wxPython2.8-win64-unicode-2.8.12.1-py27(wxPython2.8-win32-unicode-2.8.11.0-py27)
7. install ride (robotide-0.31.win32.exe)
8. install pywin module(pywin32-214.win32-py2.7)

Verify the Installation 
Open new command prompt and type ‘pybot --version’ and output like  Robot Framework 2.7.5

Now let start with writing test cases :
Example :- 
If a user want to login :-
step 1:- Given url is opened.
step 2:- when user enter his credentials. 
step 3 :- and when user click on login 
step 4 :-Then he should navigate to home page.
In this example user name and password are the mandotary, then he will be able to login.



Getting started with Ride :-
1. Make a New project in ride  as follow say Test .it should be directory.

2.Add test suite as a file say test_suitte as follow.



Write the name of suite in popup as shown.



2. Add library selenium2 in test_suitte file by clicking on library as shown in bold in following image :- 





Write name of library in popup Selenium2Library as shown.Library will be added



3. Right click on that file and click new test case say TC1.



give the name of test case in popup as :-


Test case will be added.


Generic fields for this testcase – for example documentation and tagging – can then be defined in the upper part of the editor. In the lower part the testcase is written in tabular format as a sequence of corresponding keyword calls. Thereby the keyword is written in the first column and all possible parameters in the other columns as shown in below figure.

Keywords are predefined and user can make his keywords with predefined keywords.

e.g. if a user want to login then following steps are necessary :-

1. Given url is opened.
2.When user enter credentials.
3.When click on login button.
4.Then home page should appear.

and all steps I have taken as my keywords.





Now next step is to define all user defined keywords.
Given url is opened :- 

1. right click on test file and click on add new user keyword,named - Given url is opened.



Write the name of keyword Given url is opened ,it will be added.

2.click on Given url is opened resource , in the lower part there will be tabular format.




-To open that url,add predefined keywords in table and corresponding values
-as above "open browser" is predefined keyword in selenium library.
-Predefined keywords can be find by pressing f5 . Window will be open as :-
                  
-Open browser has 2 parameters , url and browser in which url will be opened.
- here I defined url -www.gmail.com and browser - chrome

Similarly for another user defined keywords follow the same process right click on test_suitte file and add.
When user enter his credentials:-




Next step define when user enter credentials with the help of predefined keywords.

-input text and input password are predefined keywords
Input text :- it has 2 arguments .one is locator and another is testdata that we'll enter
Input password:- it has 2 arguments .one is locator and another is testdata that we'll enter

To avoid  testdata in hard code we can use list and scalar variable as follow :-
List varaible :- The varaiables that can have multiple values.
Scalar variables :- The variables that can have only single values



Click on new list variable and define variable on popup as below.

Simlarly to avoid hardcode password define list variable.


Now we can use these list variable in "When user enter his credentialsas follow :-




-As shown in above figure i have user @{txt_username}[0] in place of user1. Here [0] means first index of @{txt_username} list variable.

when clicks on login button :-

Similarly define this keyword as other user defined keyword as follow:-



After adding the keyword define keword with the help of predefined keyword as follow.



- click button is predefined keyword. 
- id = login is locator of login button.

Then home page  should appear :-



Now follow the same process that define the keyword with predefined keywords .
Here I have used element should be visible and argument is its id (id=view_profile).If the element of that id is present then home page is opened





Now to run test case , checked that test case and click on run button as follow :-



This is the process to write test cases in Ride.

Now Enjoy with Ride :-)


Tuesday, 10 April 2012

two p's of life

 I am sure many of you think like me and believe that it is not that difficult to manage the two P's of life. No doubt that it is a cold war between the two P's that has to be handled patiently to be a winner in both the P's. 

By now you all must be thinking that what the hell are these two P's :))) I will give you a hint that we all have these two P's in our life fighting with each other for existence. By now you all must have understood that it is our very own PERSONAL and PROFESSIONAL life. Hats off to those who maintain a perfect equilibrium among these two P's of their life.

Have you ever thought why so many educated and rich people always fail in their personal life? Surely because these people are too engrossed with their own works to get more knowledge and earn money. These people fail to realize that they are just hampering their personal front that will never be mended in future. Profession when given excess priority always leads to a failure at personal front. No doubt that today things have changed and people are more professional and hardly give it a thought about their personal lives. BUT! I must say that these people will surely be a big big looser in life because they fail to enjoy the love and commitments that are an integral part of a personal life.

A blend of professional and personal life is a perfect way to live life up to king size. Giving preference to both the P's is the best way to utilize the most exquisite gift of God to mankind, named LIFE. Working like professionals at work hours is not a problem if personal things are handled with equal care.

How about when you are frustrated at your professional front? The best remedy to overcome your frustration is your family. OH! What a relaxing phase that this, I am sure many of you can feel it. How patiently things are handled by our loved ones and how consoling they are, that we start feeling so relaxed after sharing hardy a couple of hours with them. Those many work hours lead to frustration and a couple of hours with family makes us relax. WHAT A PERFECT REMEDY:))

So,all you people out there, use your caliber to your best at yourprofessional front but do take extreme good care of your family. APERFECT ROAD TO FOLLOW THE PATH OF SUCCESFUL LIFE IS A BALANCE BETWEENTHE TWO FIGHTING P'S OF LIFE!!