Showing posts with label selenium RC. Show all posts
Showing posts with label selenium RC. Show all posts

Monday, September 15, 2008

How to use selenium in eclipse

Developing the selenium java along with eclipse makes the work simpler. configuring of selenium in eclipse is much more simpler than other work. I have given you few things regarding selenium eclipse.Test cases can be written in java and it can be executed using eclipse plug-in. Download Selenium Eclipse (Add the downloaded selenium plug in to your eclipse\plugins folder)

To set selenium in eclipse
Eclipse requires JUnit with Ant. The selenium project can also be developed using JUnit with Maven.
Download
Setting up of selenium in eclipse
  • Set system variables
    • JUNIT_HOME=“/*--path of junit jar file c:\selenium\junit-4.4\junit-4.4.jar--*/”
  • Set path of system variable for Ant
    • Path=“/*--path of Apache Ant bin c:\Selenium\apache-ant-1.7.1\bin --*/”
Procedures for developing selenium project in eclipse
  • Create new Selenium project in Eclipse
  • Then create a new junit testcase in that project. 
  • Add the exported testcase of selenium-ide to the new test case. 
  • Then create a new junit testsuite to run all the testcases. 
  • To run the selenium testcases, start the selenium server (selenium RC) in command prompt. 
  • Then run the test case in junit, which will automatically launch a browser and run the junit scripts in it.

Selenium Remote Control is suitable for site testing

In Previous post I mentioned overview of selenium.In this post i mentioned about why selenium RC is used. And also given you the setting up selenium RC.
  •   Selenium Core needs to make it available from the same web server as the application under test.
  •   The same origin policy states that JavaScript is only allowed to read/modify HTML from the same origin as its source.
  •   If a js file is designed to test google.com, the same origin policy denies to run that js file with google.com; instead, selenium RC can be used to test the site.
  •   Selenium RC makes a proxy server, which allows running the test against the site.
  •   For e.g.: http://www.google.com/selenium-server/MyTestSuite.html.
To Download Selenium RC (Note: FireFox 3 download can be used latest nightly .)
Setting up of selenium RC. Selenium server requires JRE 1.5 (+).
  • Set system variable
    • JAVA_HOME= “/*---path location of Java home for e.g.: c:\jdk1.5.0_12---*/”
  • Set class path of client driver for Java
    • Class path= “/*-- C:\Selenium\ selenium-remote-control-1.0-SNAPSHOT\selenium-java-client-driver-1.0-SNAPSHOT\selenium-java-client-driver.jar --*/”
Check List
  • Try in command line. Java –version (it will display the version of the java installed on the computer.)
  • Then Try using Selenium Server in Interactive mode. java -jar selenium-server.jar –interactive (This will start the selenium server and allows to create a session, opens the browser and test the site in command prompt)
Note:
If you are going to use firefox 3, then make sure that your download support. Before going to test your automation close all the firefox process in your system,which may also restrict to start browser.