Sunday 21 April 2013

Configuring Selenium WebDriver and TestNG in Eclipse

Downloading and Configuring Selenium WebDriver in Eclipse

Steps:
  1. To Download Selenium WebDriver jar file  Go to http://seleniumhq.org/download/
  2. Now Click on 2.30 under the label Selenium Server (formerly the Selenium RC Server)
  3. Selenium Standalone jar
  4. Now Open Eclipse and Create one Java project
  • Right Click on Left hand side in Eclipse under Package Explorer like in Image
  • Select NEW|JAVA PROJECT as marked in ImageNew Eclipse Java project
  • Enter the name of Project Here I have mentioned New Project and Click on Finish button Eclipse Java project
  • Go to Project Explorer Label and See new project has been created as in Image Project Created in Eclipse
  • Now Select you project and Select  NEW|Folder as in Image
  • Creating New Folder
  • Another Window Open Enter the name of Folder and Click on Finish as in Image New Folder Created
  • Now go to Location where Java Client  has been downloaded  and Copy the Selenium Server Java Client Standalone jar
  • Copy Selenium Server Standalone jar in Lib folder created under NewProject
  • Now add this standalone file in to path   by doing Right Click on Selenium Server Standalone 2.24.jar – Go to Build path|Add to Build Path as in imageAdding jar file to path
  • Now you would see a new Label named as Reference Library as in Image
  • Added Jar in build path
  • By adding Selenium Server Standalone 2.24.jar we have configured Webdriver in Eclipse

Configuring TestNG in Eclipse

  1. In Eclipse go to Help|Install New Software Configuring TestNG
  2. Enter  http://beust.com/eclipse in the field as displayed in the image below and Click on Add Button on the right side of this text field, A pop up will appear, Enter the name TestNG and click on ok button and wait for few second. After this wait you See TestNg and Select check box of  TestNg  and then click on Next and Follow the Instruction and finally click on Finish and Refresh Eclipse.
  3. Note : In between installation one pop alert will appear before you that will ask your permission to install testng since it is not trusted, In this click on Ok button..wait for installation of Testngbeust
  4. Question arises how we know that TestNg has been configured in Eclipse
    Steps
  • Go to Window | Show View | Other as in Image TestNG config Test
  • Now Select Java|TestNG|GO TestNGConfig
  • Finally to see whether Eclipse is configured or not do a final touch Right Click on you Peoject|Run As|TestNg Test as in ImageTestNG
Finally we are done with configuration of Selenium WebDriver and TestNG