steps to write selenium

33
What is Automation Testing What is Automation Testing Automation testing use software or automation tool to create and execute test script which is written in scripting language for example java script. Automation testing Benefits : Automation tool save time when regression and Smoke test required. Automation tool run test case faster than human users. Automation tool help to address the load, stress and performance of the product. Automation tool improve software quality. Automation tool required less time and fewer resources .

Upload: rohit-thakur

Post on 18-Jul-2015

197 views

Category:

Technology


2 download

TRANSCRIPT

What is Automation Testing What is Automation Testing

Automation testing use software or automation tool to create and execute test script which is written in scripting language for example java script.

Automation testing Benefits :

Automation tool save time when regression and Smoke test required.

Automation tool run test case faster than human users.

Automation tool help to address the load, stress and performance of the product.

Automation tool improve software quality.

Automation tool required less time and fewer resources .

Automation Tools Automation Tools

There are lot of testing tools available in the market and each tool is capable of doing specific testing such as functional and non functional testing. The automation tools that are widely used in functional and non functional testing.

Functional Testing tools

1)Quick Test Professional (Required licenses) 2)Selenium (Web Driver, Selenium RC) (Open Source)

Non Functional Tools 1) HP Loader( Required licenses) 2) Apache Jmeter (Open Source)

Selenium –Functional Testing ToolSelenium –Functional Testing Tool

Selenium is a functional testing tool that automates web and mobile application with the help of web browsers like (Mozilla Firefox, Chrome, Internet explorer, Opera and Safari).

It is open source tool (freely available in Internet market) and support many language like HTML, Java/Script , Ruby, Python, C# etc.

Selenium provide record and play back feature and user can convert recorded script in any language.

Component Used to Generate Manual Test ScriptComponent Used to Generate Manual Test Script

1.Selenium IDE is a Firefox add-on that provide record and playback feature and you can export or convert the recorded script in any languages like HTML, Java, .NET, Perl, Ruby and python You can run and customize script in the eclipse by adding Selenium web driver.

2.Selenium Web Driver 2.Selenium Web Driver is Application programming interface and collection of libraries. Using selenium web driver we can customize or edit script with the help of Eclipse frame-work .Each scripting language use specific web driver to generate and customize script for example C# language use Selenium .NET web driver and Visual studio framework to run and customize the script.

3.Eclipse is an integrated development environment (IDE) is used to develop test script. Eclipse framework support many languages like Java, Java script, Ruby, Python, C, C+, PL/SQL, Vb.net script.

Steps to Add Selenium IDE Plug-in

Step 1: Open seleniumhq.org website in Mozilla Firefox ,Click on download tab

and Click Version 2.6.0 link to install plug-in.

Selenium ask you to install following items

Restart Mozilla Firefox Web Browser

Verify all language formatter Installed Properly Click on Tool menu – Add-on

Open website in Mozilla Firefox

Open Mozilla Firefox enter web site URL in the URL Box of Mozilla

Steps to Record Test Script Using Selenium IDE Steps to Record Test Script Using Selenium IDE

Step 1: Click on tools menu then click Selenium IDE option a pop will appear as given below

Step:3: Enter base URL and minimize selenium IDE Pop

Visit Website to Record ScriptVisit Website to Record Script

Maximize Sel. IDE Pop Up & Stop Recording Maximize Sel. IDE Pop Up & Stop Recording

Execution Commands

Stop Recording

Reference of the currently selected command

Change HTML Default Recording Mode To ScriptingChange HTML Default Recording Mode To Scripting

Click on option menu to select scripting language option

Enable Scripting Language OptionEnable Scripting Language Option

You need to check mark this option

Now Convert HTML to Java Script Now Convert HTML to Java Script

Click on web driver

On Click J-Unit Web Driver a Pop Will Appear On Click J-Unit Web Driver a Pop Will Appear

Click ok button

On Click Ok Button HTML Code Converted to Java ScriptOn Click Ok Button HTML Code Converted to Java Script

Copy this Code

Open Eclipse to Run Java Script Open Eclipse to Run Java Script

Steps: 1 Open adt (Eclipse) folder saved in your hard disk. Steps: 2 Click on Eclipse icon.Steps: 3 Splash Screen will appear with Dialog box To choose location to save your script

Steps:4 Click on Ok button eclipse will be open

Create Project in the Eclipse Create Project in the Eclipse

Steps Click on file menu . Click on new . Then click project

Give name to your project Give name to your project

Steps : Give name to project then click next button

Define the Java Build Setting Define the Java Build Setting

Add Selenium Web Driver to Click Library Tab Add Selenium Web Driver to Click Library Tab

Click on Add External JARS..Click on Add External JARS..

Verify Jars files will attached with Java Build Verify Jars files will attached with Java Build

Open Project Explorer to See Java Build Open Project Explorer to See Java Build

Right Click On Project to Add Class fileRight Click On Project to Add Class file

Give Name To Class file Give Name To Class file

Step 1:Give name to class file . Choose Method Click on Finish button a class file will appear

Remove Code from class file and Past Sel. IDE Script Remove Code from class file and Past Sel. IDE Script

Edit and Run Recorded Script Edit and Run Recorded Script

Choose Launcher to Run ScriptChoose Launcher to Run Script

Save and Launch Resource Save and Launch Resource

Output of Java Script Output of Java Script

The End The End

Prepared byPrepared by

Rohit thakur Rohit thakur