Sunday, October 28, 2012

Selenium_Overview


Topic: Selenium



1. Overview
2. Compare IDE, RC, Web Drive
3. Selenium RC 
4. Xpath
5. ANT 
Selenium Overview




1. Selenium is automation testing tool which work only on the browser it is works across all the browsers and multi operating system.
  2. Selenium is independent of the languages. It has various components like web drivers, RC.
  3. It is extremely in demand, rapidly growing with world-wide and it is open source tool.
  4. It’s easy use of UI.


      

      Difference between Selenium IDE, RC and Web Drive



Selenium RC
Suppose You want to create frame work or want to run test case which required to change the test data frequently or need to be repeated data; else you want to check some condition , to do verification,  to use reusable function ….Then IDE fail in that .To do these need to do the programing then selenium RC is introduce.


Difference between Assert and Verify
Assert: It is allow the test to check if the element is present on the page or not if not then test will stop on the failed step.
Verify:It is allow the test to check if the element is present on the page or not if not then test wil carry on



 

Xpath
  What is Xpath?
• The Xpath is unique address for each and every element on the page.
• It is use for finding the position of the element.
• It is make for the every element


XPath Format:------  //html tag[@attribute name=’attribute value’]
f. Eg: //input [@type=’button’]

Using Firebug you can find out the XPath for the element.
There is  one good add-on for to finding the XPath that is “XPath Checker” 

Difference between Assert and Verify
 Assert: It is allow the test to check if the element is present on the page or not if not then test will stop on the failed step.
Verify:It is allow the test to check if the element is present on the page or not if not then test wil carry on  
ANT

    What’s ANT?
It is open source tool.
Ant can be used to generate the html report
Ant build file written in the XML.
Download the ANT latest Version from following link:
http://ant.apache.org/bindownload.cgi

How to make build.xml file?
 1. Right click on the project
2. Go to the new>>file gives the filename as build.xml

Example
<?xml version="1.0" encoding="UTF-8"?>
<project name="Dienmay automation" default="Dienmay_auto" basedir=".">
<property name="src" location="src"/>
<property name="build" location="build"/>
<!-- get class path, used for build -->
<property name="lib.dir" value="lib"/>
<path id="classpath">
        <fileset dir="${lib.dir}" includes="**/*.jar"/>
<pathelement location="build"/>
    </path>
<target name="init">
<delete dir="build"/>
<delete dir="testng_output"/>
<delete file="Dienmay_Auto.log" />
<mkdir dir="${build}"/>
</target>
<!-- build all java file to class binary -->
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}" classpathref="classpath" encoding="utf-8"
includeantruntime="false"/>
</target>

<!-- Config for testng -->
<taskdef name="testng" classname="org.testng.TestNGAntTask">
    <classpath>
    <pathelement location="lib/testng-6.1.1.jar"/>
    </classpath>
 </taskdef>
<property name="testng.output.dir" value="testng_output"/>

<!-- execute testng after compile, then generate report -->
<target name ="Dienmay_auto" depends="compile">
<mkdir dir="${testng.output.dir}"/>

<!-- config testng -->
    <testng outputdir="${testng.output.dir}" classpathref="classpath"
    useDefaultListeners="false"
    listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter" >
   
    <!-- execute testcase follow testng.xml -->
    <xmlfileset dir="." includes="testng.xml"/>
   
    <!-- generate report title -->
    <sysproperty key="org.uncommons.reportng.title" value="Dienmay Automation"/>
    <sysproperty key="org.uncommons.reportng.escape-output" value="false"/>
    </testng>
</target>

</project> 
 

    

No comments:

Post a Comment