Friday 17 February 2012

Selenium IDE split text - Get require string from sentence

Split text from sentence

Suppose you have sentence as 'my name is : radical' and you want only radical text from whole sentence, use below code

store   | my name is : radical | string
  store | 1 | delimiter
  store | javascript{storedVars['string'].split('is :')[storedVars['delimiter']]} | name
 echo  | ${name}

Selenium IDE: Random Number Generator Using Selenium IDE

Generate random number in selenium IDE

type  |  field  | javascript{Math.floor(Math.random()*11)}  

You can increase number of 1 to increase number of digits

similarly you can use for email 

type | field | javascript{"joe+" + Math.floor(Math.random()*11111) + "@gmail.com";}


Saturday 11 February 2012

Get XPATH in IE

Here is a way to find the XPATH on IE...


STEPS TO INSTAL BOOKMARKLETS
1)Open IE
2)Type 
about:blank in the address bar and hit enter
3)From Favorites main menu select--->Add favorites
4) In the Add a favorite popup window enter name 
GetXPATH1.
5)Click add button in the add a favorite popup window.
6)Open the Favorites menu and right click the newly added favorite and select properties option.
7)GetXPATH1 Properties will open up. Select the web Document Tab.
8)Enter the following in the URL field.
javascript:function getNode(node){var nodeExpr=node.tagName;if(!nodeExpr)return null;if(node.id!=''){nodeExpr+="[@id='"+node.id+"']";return "/"+nodeExpr;}var rank=1;var ps=node.previousSibling;while(ps){if(ps.tagName==node.tagName){rank++;}ps=ps.previousSibling;}if(rank>1){nodeExpr+='['+rank+']';}else{var ns=node.nextSibling;while(ns){if(ns.tagName==node.tagName){nodeExpr+='[1]';break;}ns=ns.nextSibling;}}return nodeExpr;}

9)Click Ok. Click YES on the popup alert.
10)Add another favorite by following steps 3 to 5, Name this favorite GetXPATH2 (step4)
11)Repeat steps 6 and 7 for GetXPATH2 that you just created.
12)Enter the following in the URL field for GetXPATH2

javascript:function o__o(){var currentNode=document.selection.createRange().parentElement();var path=[];while(currentNode){var pe=getNode(currentNode);if(pe){path.push(pe);if(pe.indexOf('@id')!=-1)break;}currentNode=currentNode.parentNode;}var xpath="/"+path.reverse().join('/');clipboardData.setData("Text", xpath);}o__o();

13)Repeat Step 9.

You are all done!!

Now to get the XPATH of elements just select the element with your mouse.Select the element(link, button, image, checkbox, text etc) then select the favorite GetXPATH1 from the favorites menu and then select the second favorite GetXPATH2. At his point if you get any confirmation, hit allow access button. Now open up a notepad file, right click and select paste option. This will give you the XPATH of the element you seek.


Friday 10 February 2012

Selenium IDE - parameterization

For parameterization you need to create js file
For eg. Js file contains
  var username=new Array("parameterization1@mailinator.com","parameterization2@mailinator.com");
  var password=new Array("parameterization1","parameterization2");

Sample script for parameterization



Selenium IDE Flow Control - Goto and While Loop


For looping statement you need to add selenium extension goto_sel_ide.js. You can get this from here .

Upload that file to selenium IDE

Options > options > selenium core extension




Below is sample script for  Flow Control


 

 

Send email functionality using Gmail




open               | http://www.gmail.com
type                | id=Email                     |tester
type                | id=Passwd                  | tester@123
clickAndWait    | id=signIn
clickAt             | //div[@id=':oy']/div/div
type               | name=to                      |  testing@gmail.com
 type              | name=subject              | testSubject
type               | css=body[class='editable  LW-avf'] | testing
keyPress         | //div/b[text()='Send']    | 13

Performance

Tools for identifying the performance of web application

1.YSlow
2.Page Speed

These are browsers add-on very useful for performance measure, you can download them from below links - 




There are some best practices for Speeding Up Your Web Site
You can see those practices here .


Tuesday 7 February 2012

Software Testing

What is Software Testing?
It is an activity to evaluate and ensure the correctness and reliability of the software or program with respect to its requirements or expectation.
Importance of Software Testing:
For a while, just think that you are still in 1950 and you want to talk to a person who is at huge distance from you even without paying much money then it is just a dream. But not now .
Even the average person was never ready to buy a computer in his home due to it’s high costing but now its a common thing for us. Most of us can’t go a day without checking our emails or chat with friends/family now. We are depending on internet, gadgets, phone services and competitive medical services.
Software is everywhere and as it is created by people, it is not perfect. There are few examples as below.
  • Disney’s lion king : Program was not worked on all operating system and it became news for TV and Newspapers.
  • US patriot missile defense system: This system was used during gulf war as a defense system for Iraqi scud missiles. But during war, it was failed to do so. And approx 28 US soldiers were killed.During investigation, they have found that it was because of software bug. System timing was not much accurate after 14 hrs and during war, the system had been operated for more that 1000 hrs.
  • The Y2K [2000 year] bug: A programmer programmed a software such that it considered YY instead of YYYY just for saving memory. It was failed on end of 1999. It considered 00 and 01 instead of 2000 and 2001.It is estimated that several hundred millions of dollor were spent to update or replace the software which was worked like that.
From above case studies, it is cleared that impact of such software failure will be very serious with loss of image, lives or finance.
Due to such countless events create  importance of software testing automatically and now, it is becoming career for a life.