Below info gives a good begining OOPS concepts Object-An object is a software bundle of related state(Color,Height etc) and behavior(Selection).An object stores its state in fields (variables) and exposes its behavior through methods (functions).Ex-Vehicle. Class-Class is ma collection of objects. Inheritance-Different kinds of objects often have a certain amount in common with each other. Cars,Bikes etc for example, all share the characteristics of vehicles (speed, gear). class Student{ int rollno; String name; void insertRecord(int r, String n){ //method rollno=r; name=n; } void displayInformation(){System.out.println(rollno+" "+name);}//method public static void main(String args[]){ Student s1=new Student(); Student s2=new Student(); s1.insertRecord(111,"Karan"); s2.insertRecord(222,"Aryan"); s1.displayInformation(); s2.displayInformation(); } } The syntax for creating a subclass is simple. At the beginning of your class declaration, use the extends keyword, followed by the name of the class to inherit from: class car extends vehicle { } Interface-interface is a group of related methods without definition i.e code in them. Class which implements the interface defines the methods. Ex- Buttons on a Remote act as Interface betweenTV and the viewer. A vehicles behavior, if specified as an interface, might appear as follows:interface Vehicle { void changeGear(int newValue); void speedUp(int increment); } To implement this interface, the name of your class would change (to a particular brand of vehicle, for example, such as car), and you'd use the implements keyword in the class declaration: class car implements vehicle { public void changeGear(int newValue){ System.out.println("Change gear");} public void speedUp(int increment){ System.out.println("Change speed");}} Package-A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer. Selenium Server Selenium Server receives Selenium commands from your test program, interprets them, and reports back to your program the results of running those tests. Installing Selenium Server Install Java SE Development Kit 7u15 and then Eclipse for Java EE Developers(Juno). The Selenium RC server is simply a Java jar file (selenium-server-standalone-<version-number>.jar), which doesnââ?¬â?¢t require any special installation. Just downloading the zip file and extracting the server in the desired directory is sufficient. Running Selenium Server Before starting any tests you must start the server. Go to the directory where Selenium RCââ?¬â?¢s server is located and run the following from a command-line console. java -jar selenium-server-standalone-<version-number>.jar This can be simplified by creating a batch file(.bat) containing the command above. Then make a shortcut to that executable on your desktop and simply double-click the icon to start the server.For the server to run youââ?¬â?¢ll need Java installed. Using the Java Client Driver ââ?? Download Selenium java client driver zip from the SeleniumHQ downloads page. ââ?? Extract selenium-java-<version-number>.jar file ââ?? Open Java IDE i.e Eclipse ââ?? Create a java project using File-New-Java Project ââ?? Then create a package using File-New-Package. ââ?? Then create TestNG Class from File-New-Other-TestNG-TestNG Class. ââ?? Add the selenium-java-<version-number>.jar files to your project as references.Right click on Project and select Build Path-Configure build path. Select Libraries tab and click on Add external jars.- 1)Add Java client jars 2)Add TestNG jar Xpath-Install Firebug and xpath checker addons in Firefox. Open Firebug from Tools-Web developer-Firebug-Open Firebug.In xpath checker write xpath in the format //input[@id='xxx'] by using the HTML tag displayed in Firebug. Then the object will be displayed in XPath Checker window. Sample TestNG code package sampleTest; import org.testng.annotations.Test; import org.testng.annotations.BeforeClass; import org.testng.annotations.AfterClass; import com.thoughtworks.selenium.DefaultSelenium; import com.thoughtworks.selenium.Selenium; public class NewTest { protected Selenium sel; @Test public void start() { } @BeforeClass public void startServer() { sel = new DefaultSelenium("localhost",4444,"*firefox","http://www.google.com"); sel.start(); try { sel.open("/"); sel.waitForPageToLoad("30000"); } catch(Exception e) { } } @AfterClass public void stopserver() { sel.close(); sel.stop(); } } Learning the API Starting the Browser setUp("http://www.google.com/", "*firefox");-This starts a Browser instance.The parameters required when creating the browser instance are:host-Normally localhost is passed. This is optional parameter.port-This is optional parameterbrowserurlReporting ResultsJava has two commonly used test frameworks, JUnit and TestNG. .NET also has its own, NUnit.
Ads