Selenium Date:06/10/2009. May 13, 2009 2 Agenda Testing – Test Automation Selenium – Introduction – Features – Supported platforms Selenium Commands –

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Test Automation with Selenium
Selenium Automation Testing Suite of Tools
Pubman and Selenium tests. What is Selenium Selenium is a suite of Web application test automation tools for any browser on any operating system –Firefox,
Selenium HP Web Test Tool Training
Test Automation Framework Ashesh Jain 2007EE50403 Manager Amit Maheshwari.
The Web Warrior Guide to Web Design Technologies
XP Information Technology Center - KFUPM1 Microsoft Office FrontPage 2003 Creating a Web Site.
Server-Side vs. Client-Side Scripting Languages
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
1 Computing for Todays Lecture 22 Yumei Huo Fall 2006.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Softsmith Infotech1 Test Automation Using Selenium.
Selenium – Testing Tool. What is Selenium? Selenium is a robust set of tools that supports rapid development of test automation for web-based applications.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
Selenium Automation Testing Suite of Tools. What is Selenium? Selenium is a robust set of tools that supports rapid development of test automation for.
Eclipse is an open source IDE (Integrated Development Environment) for developing applications in Java, C/C++, HTML, Cobol, Perl, etc. The official Eclipse.
Selenium Web Test Tool Training Using Ruby Language Discover the automating power of Selenium Kavin School Kavin School Presents: Presented by: Kangeyan.
Automation using Selenium Authored & Presented by : Chinmay Sathe & Amit Prabhu Cybage Software Pvt. Ltd.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Linux Operations and Administration
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Classroom User Training June 29, 2005 Presented by:
Selenium automated testing in Openbravo ERP Quality Assurance Webinar April 8th, 2010.
Val Kravets, Luis Sanchez, Allen Chung, Phillip Anderson, Leyla Norooz, Brian Ramnarian, Todd Watson.
© 2012 LogiGear Corporation. All Rights Reserved Robot framework.
Testing Web applications. Selenium What is Selenium? Selenium is a suite of tools to automate web application testing across many platforms Tests run.
Creating a Web Site to Gather Data and Conduct Research.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Selenium Web Test Tool Training Using Ruby Language Discover the automating power of Selenium Kavin School Kavin School Presents: Presented by: Kangeyan.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
Selenium and Selenium on Rails. Agenda  Overview of Selenium Simple Selenium Tests Selenium IDE  Overview of Selenium on Rails  Problems with Selenium.
Web Automation Testing With Selenium By Rajesh Kanade.
Pubman and Selenium tests. What is Selenium Selenium is a suite of Web application test automation tools for any browser on any operating system –Firefox,
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
XP Tutorial 8 Adding Interactivity with ActionScript.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Selenium January Selenium course content  Introduction (Session-1)Session-  Automation  What is automation testing  When to go for automation.
Introduction Selenium IDE is a Firefox extension that allows you to record, edit, and debug tests for HTML Easy record and playback Intelligent field selection.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Automated Web Page Testing with Selenium IDE: An Overview Mary Ann May-Pumphrey 11/20/08.
Test Automation For Web-Based Applications Portnov Computer School 1 Selenium HP Web Test Tool Training.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Unit 1 – Web Concepts Instructor: Brent Presley.
Quick Test Professional 9.2. Testing Process Preparing to Record Recording Enhancing a Test Debugging Running the Test and Analyzing the Results Reporting.
SELENIUM By- Vivek Singh Jeena, Inderpreet Singh, Ankusha Saxena, Bhanupriya D.P, Shubham Yadav, Madhavi Aminigadda.
Selenium server By, Kartikeya Rastogi Mayur Sapre Mosheca. R
Test Automation Using Selenium Presented by: Shambo Ghosh Ankit Sachan Samapti Sinhamahapatra Akshay Kotawala.
Text Selenium server 31 – October By, Vivek Singh Jeena Inderpreet Singh Ankusha Saxena Bhanupriya D.P Shubham Yadav Madhavi Aminigadda.
Microsoft Office 2008 for Mac – Illustrated Unit D: Getting Started with Safari.
Tata Consultancy Services1 WebDriver Basics Submitted By : Akhil K Gagan Deep Singh Naveenrajha H M Poornachandra Meduri Shubham Utsav Sunil Kumar G Vivek.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Sitecore Basic Training Content Management System (CMS) University Communications Web Services
XP Creating Web Pages with Microsoft Office
C Copyright © 2009, Oracle. All rights reserved. Using SQL Developer.
Arklio Studija 2007 File: / / Page 1 Automated web application testing using Selenium
JRA2: Acceptance Testing senarious
Selenium HP Web Test Tool Training
Testing With Selenium - Open source Test Automation Tool
Selenium Tutorials Cheyat Training.
Web Application Development Using PHP
Selenium IDE Installation and Use.
Presentation transcript:

Selenium Date:06/10/2009

May 13, Agenda Testing – Test Automation Selenium – Introduction – Features – Supported platforms Selenium Commands – Selenese – Script syntax Selenium Components – Selenium IDE – Selenium RC – Selenium Grid – Selenium Core Selenium IDE – Building test cases – Running test cases – Converting to other languages – Editing test cases and running with Selenium RC Selenium RC – Running HTML test suite

May 13, Testing: Test Automation Test automation is a process of writing a computer program to do testing that would otherwise need to be done manually Alternative to the tedious manual testing Overcomes the defects of manual testing Cost effective method Two approaches of test automation – Code Driven Testing – Graphical User Interface (GUI) Testing

May 13, Testing: Test Automation contd... Test automation supports: – Frequent regression testing – Rapid feedback to developers during the development process – Virtually unlimited iterations of test case execution – Customized reporting of application defects – Support for Agile and eXtreme development methodologies – Disciplined documentation of test casesCustomized reporting of application defects – Finding defects missed by manual testing

May 13, Selenium: Introduction Selenium is one of the most powerful open source automation tools for web application testing Primarily developed in Java Script and browser technologies such as DHTML and Frames and hence supports all the major browsers on all the platforms. In terms of coverage for platform and browser, Selenium is probably one of the best tool available in the market for web applications User can customize the selenium tool based on their requirement (code is available for the user).

May 13, Selenium: Introduction contd... Highly flexible Highly extensible Selenium Components – Selenium-IDE – Selenium-Remote Control (RC) – Selenium-Grid – Selenium Core

May 13, Selenium: Features Open Source tool for Web applications Tests Browser Compatibility and system functionality No licensing cost associated with it Customize according to our requirements Easy to use: – a) Test Cases are written in pure HTML – b) Clean and Impressive User Interface Selenium supports multi platform and multi browser in terms of coverage.

May 13, Selenium: Supported Platforms Windows: – Internet Explorer 6.0+ – Firefox 0.8 to 2 – Seamonkey 1.0 – Opera 8 Mac OS X: – Safari 1.3+ – Firefox 0.8 to 1.5 – Seamonkey 1.0 Linux: – Firefox – Konqueror

May 13, Selenium Commands: Selenese Selenium provides a rich set of commands for fully testing the web-application in virtually any way. The command set is often called selenese. These commands essentially create a testing language. A command tells selenium what exactly to do. There are three types of Selenium commands – Actions – Accessors – Assertions

May 13, Selenium Commands: Selenese contd... The selenese commands can test: – existence of UI elements based on their HTML tags – test for specific content – test for broken links, input fields, selection list options, submitting forms, and table data among other things – window size, mouse position, alerts – Ajax functionality – pop up windows and event handling

May 13, Selenium Commands: Selenese contd... Actions – Selenium Actions represent something a user would do – Commands that generally manipulate the state of the application – They do things like “click this link” and “select that option”. – If an Action fails, or has an error, the execution of the current test is stopped. – Many Actions can be called with the “AndWait” suffix, e.g. “clickAndWait”. – This command makes the browser to wait till the page loads

May 13, Selenium Commands: Selenese contd... Accessors: – Examine the state of application and store the results in variables – Any of the selenium accessors can be used to store value – Internally Selenium uses a map called storedVars keyed to the variable names. – They are also used to automatically generate Assertions – E.g. Use ${intAmount} to put the value stored in intAmount – Some of the key accessors are storeText, storeValue, storeCookie, storeAlert and storeEval

May 13, Selenium Commands: Selenese contd... Assertions: – Allows user to verify state of the application – All Selenium Assertions can be used in 3 modes Assert – Upon failure test is aborted Verify – Upon failure error is logged and test continues WaitFor – Waits for a conditions truth lines for given timeout – Assertions are like Accessors, but they verify that the state of the application conforms to what is expected E.g. “make sure the page title is X” and “verify that this checkbox is checked”

May 13, Selenium Commands: Script Syntax Selenium Commands consist of the command and two parameters. For eg: – verifyText //div//a[2] Login The parameters are not always required. It depends on the command In some cases both parameters are required, in others one parameter is required, and still in others the command may take no parameters at all. For eg.: – goBackAndWait command requires no parameter GoBackAndWait – verifyTextPresent command requires only one parameter verifyTextPresent Welcome to My Home Page – type command requires both the parameters type id=phone (555)

May 13, Selenium Commands: Script Syntax contd... Commonly used Selenium Commands – click/clickAndWait performs a click operation, and waits for a new page to load – verifyTitle/assertTitle verifies an expected page title – verifyTextPresent verifies expected text is somewhere on the page – waitForPageToLoad pauses execution until an expected new page loads. Called automatically when clickAndWait is used

May 13, Selenium Components There are four variants or components of Selenium They can be used in isolation or in combination to create complete automation suite for the web applications. These components are – Selenium IDE – Selenium Remote Control (RC) – Selenium Grid – Selenium Core

May 13, Selenium Components: Selenium IDE Selenium IDE is a Firefox plug in, which includes the entire Selenium Core, allows to record, play back, edit, and debug tests in browser Selenium IDE is the only flavor of Selenium which allows to record user actions on browser window It can also record user actions in most of the popular languages like Java, C#, Perl, Ruby etc. This eliminates the need of learning new vendor scripting language. Selenium default scripts are html (added JavaScript)

May 13, Selenium Components: Selenium IDE contd... Selenium IDE – Installation – The installation is very simple. – It comes as the firefox plug in and it directly gets installed at the time of downloading itself, provided that firefox is installed – After installation it can be started directly from firefox Tools menu

May 13, Selenium Components: Selenium IDE contd...

May 13, Selenium Components: Selenium IDE contd... Selenium IDE contains toolbar including various buttons which are helpful in recording and running the tests Speed Control controls how fast the test case runs Run All runs the entire test suite when a test suite with multiple test cases is loaded Run runs the currently selected test Pause/Resume allows stopping and re-starting of a running test case Step allows one to “step” through a test case by running it one command at a time Record records the user's browser action

May 13, Selenium Components: Selenium IDE contd... TestRunner Mode allows to run the test case in a browser loaded with the Selenium-Core TestRunner. The TestRunner is not commonly used now and is likely to be deprecated. Test case pane displays the script. It has two tabs, one for displaying the command and their parameters in a readable “table” format. – Source tab displays the test case in the native format in which the file will be stored. By default, this is HTML – The Command, Target, and Value entry fields display the currently selected command along with its parameters.

May 13, Selenium Components: Selenium IDE contd... Log/Reference/UI-Element/Rollup Pane is used for four different functions–Log, Reference, UI-Element, and Rollup–depending on which tab is selected. – Log tab displays error messages and information messages showing the progress – Reference tab will display documentation on the current command. – The information for UI-Element and Rollup tab can be found in Help menu of Selenium IDE

May 13, Selenium Components: Selenium IDE contd... Test case pane Speed Control Run All Run Pause/Resume Step Test Runner Log/Reference/UI-Element/Rollup Pane Record

May 13, Selenium Components: Selenium IDE contd... Selenium IDE features – Easy record and playback – Debug and set breakpoints – Conversion of test cases to multiple programming languages – Option to automatically assert the title of every page – Support for Selenium user-extensions.js file – Very useful for beginners to understand the test cases and commands

May 13, Selenium Components: Selenium IDE contd... Selenium IDE is useful for less technical people, as it supports only simple programming and not the tests with complex programming functions Selenium does not directly support: – condition statements – Iteration – logging and reporting of test results – database testing – test case grouping – test case dependency

May 13, Selenium Components: Selenium RC Selenium Remote Control is a test tool that allows to write automated web application in any programming language (Java,.NET, Perl, Python, and Ruby, PHP) Selenium-RC is the solution for tests that need more than simple browser actions and linear execution. It uses full power of programming language. It overcomes the disadvantages of IDE Selenium RC can create more complex tests like reading and writing files, querying a database, ing test results.

May 13, Selenium Components: Selenium RC contd... Although tasks that are not supported by IDE, are not supported by Selenium directly, all of them can be achieved by using programming techniques with a language-specific Selenium-RC client library. There are two components of Selenium RC, which play an important role in the running of the test cases. The components of Selenium RC are: – Selenium Server – Client Libraries

May 13, Selenium Components: Selenium RC contd... Selenium Server – Launches and kills browsers – Interprets and runs the Selenese commands passed from the test program – Acts as an HTTP proxy, intercepting and verifying HTTP messages passed between the browser and the AUT. Client libraries – Provide the interface between each programming language and the Selenium-RC Server.

May 13, Selenium Components: Selenium Grid Selenium Grid allows to run Selenium tests in parallel Cuts down the time required for running acceptance tests to a fraction of the total time it currently takes Selenium Grid runs on top of Selenium Remote Control It is primarily used in case of large test suites or the test suites that need to be run in multiple environment To run Selenium Grid, Ant 1.7+ needs to be installed on the system.

May 13, Selenium Components: Selenium Core Selenium Core is a Test Tool for web applications Selenium core tests runs directly in a Browser Written in Pure JavaScript and DHTML Selenium RC server uses Selenium Core while sending the requests to the browser Selenium Core interprets and executes Selenese commands using the browser’s built-in JavaScript interpreter

May 13, Selenium IDE: Building Test Cases There are three methods which are used in order to build the test cases. The developer, while building the test cases with Selenium IDE, requires all the three methods frequently. These methods are – Recording – Adding Verifications and Asserts With the Context Menu – Editing

May 13, Selenium IDE: Building Test Cases contd... Recording – This method records the user actions with the application under test. – To record the tests, start selenium IDE. – The record button on Selenium IDE toolbar is ON by default. – During recording, Selenium-IDE will automatically insert commands into the test case based on actions including, clicking a link entering values selecting options from a drop-down listbox clicking checkboxes or radio buttons

May 13, Selenium IDE: Building Test Cases contd... Adding Verifications and Asserts With the Context Menu – In order to do this, with Selenium-IDE recording, open the web page – Select some text and right click on the selected text – A context menu showing verify and/or assert commands gets displayed – Also, the Show All Available Commands menu option also gets displayed – This shows many, many more commands, again, along with suggested parameters, for testing currently selected UI element

May 13, Selenium IDE: Building Test Cases contd... Editing – Editing commands include inserting a new command or comment and editing the existing command or comment in the table view or source view – Insert Command To insert a command in table view, select the point in the test case where the command has to be inserted. Right-click and select Insert Command. Now use the command editing text fields to enter the new command and its parameters. To insert a command in source view, select the point in the test case where the command has to be inserted, and enter the HTML tags needed to create a 3-column row containing the Command. Be sure to save the test before switching back to Table view.

May 13, Selenium IDE: Building Test Cases contd... – Insert Comment To insert a comment in the table view, select the point in the test case where the comment has to be inserted. Right-click and select Insert Comment. Now use the Command field to enter the comment. The comment appears in purple font To insert a comment in the source view, select the point in the test case where the comment has to be inserted. Add an HTML-style comment, i.e.,

May 13, Selenium IDE: Building Test Cases contd... Edit a Command or Comment – To edit an existing command or comment in table view, simply select the line to be changed and edit it using the Command, Target, and Value fields – To edit an existing command or comment in source view, simply modify which line wished–command, parameter, or comment, since source view provides the equivalent of a WYSIWYG editor The File=>Open, Save and Save As menu commands behave similarly to opening and saving files in most other programs. When an existing test case is opened, Selenium-IDE displays its Selenium commands in the test case pane.

May 13, Selenium IDE: Running Test Cases IDE allows many options to run the test cases. With IDE, lot of things are possible. For instance, running the whole test case, starting and stopping it, running it one line at a time, and a batch run of entire test suite. Execution of test cases is very flexible Run a Test Case – Click the Run button to run the currently displayed test case Run a Test Suite – Click the Run All button to run all the test cases in the currently loaded test suite

May 13, Selenium IDE: Running Test Cases contd... Stop and Start – The Pause button can be used to stop the test case while it is running. The icon of this button then changes to indicate the Resume button. To continue click Resume Stop in the Middle – A breakpoint can be set in the test case to cause it to stop on a particular command. This is useful for debugging the test case. To set a breakpoint, select a command, right-click, and from the context menu select Toggle Breakpoint

May 13, Selenium IDE: Running Test Cases contd... Start from the Middle – The IDE can be told to begin running from a specific command in the middle of the test case. This also is used for debugging. To set a start- point, select a command, right-click, and from the context menu select Set/Clear Start Point Run Any Single Command – Double-click any single command to run it by itself. This is useful when writing a single command. This is very useful on having a doubt while writing the command

May 13, Selenium IDE: Running Test Cases contd... Using Base URL – The base URL field at the top of IDE is very useful in running the test cases in different domains – This is useful when the site has some in-house beta site. – Any test cases for a those particular sites that begin with an open statement should specify a relative URL as the argument to open rather than an absolute URL (one starting with a protocol such as http: or

May 13, Selenium IDE: Running Test Cases contd... For eg: – The test case is running against – This same test case with a modified Base URL setting would be run against

May 13, Selenium IDE: Converting to other language One of the best feature of Selenium IDE is that it can convert the recorded test cases to different languages, such as Java, Ruby, Python, C# etc. With this conversion, the test cases can be run with selenium RC with the help of the language specific client libraries To convert the recorded test cases, Go to Options menu and click Format. On clicking Format a drop-down appears. Select the preferred language and the test cases get converted to the selected language.

May 13, Selenium IDE: Converting to other language contd... The converted test cases appear in the Source tab of Test pane. Selenium IDE cannot run these converted test cases

May 13, Selenium IDE: Converting to other language contd... These tests does not contain any programming logic such as conditions, testing database etc. These test cases can be executed with the help of the client libraries available for respective language in Selenium RC Optionally, test engine platform like Nunit and TestNG be adopted TestNG and Junit are the test engines very commonly used for Java Some development environments like eclipse has direct support for these test engines via plugin

May 13, Selenium IDE: Editing test cases and running with Selenium RC As discussed, Selenium IDE can record the test cases and can convert them to any of the languages of Java, Ruby, Python, Perl, C#,.Net etc To run these test cases, Selenium RC is used, as Selenium IDE can not run the test cases apart from those written in HTML Selenium RC uses language specific client drivers to run these test cases. For example, for running test cases in Java Selenium RC has Selenium-Java-client- driver

May 13, Selenium IDE: Editing test cases and running with Selenium RC contd... In order to run the test cases with Selenium RC, they have to be saved with respective extensions. For example, in order to run the test case that is converted to Java from Selenium IDE, it has to saved with extension.java Selenium RC, with the help of language specific client drivers, executes the test cases from different languages. The test cases that are exported from Selenium IDE may not be run directly with Selenium IDE. These test cases may require some editing in order to run them with Selenium RC.

May 13, Selenium IDE: Editing test cases and running with Selenium RC contd... The editing of the test cases, depend on the language the test case is converted in. For example, in order to run the test cases in Java, the class containing main method should be added. Likewise few lines of code may need to be added in the test cases, depending on the language Here are the sample main class that completes the test case and makes it ready to run as a Java test case using Java client driver. public static Test Suite(){ return new TestSuite(Classname.class); } public static void main(String args[]){ junit.textui.TestRunner.run(Suite()); }

May 13, Selenium RC: Running HTML test suite The Selenium RC server comes as an executable jar file This executable jar file comes with all the language specific client libraries Running the jar file allows to run the various test suites designed in the various languages with the help of the client libraries of respective languages The selenium RC can be downloaded from –

May 13, Selenium RC: Running HTML test suite contd... Selenium IDE records the user actions and stores these user actions in the source tab of the test pane. The user actions are recorded and the test cases that are stored by selenium IDE are primarily stored in HTML. These HTML test cases can also be run with Selenium RC To run the test cases with Selenium RC, the test cases should be copied to some file with.html extension say Test.html Selenium RC cannot run test cases directly

May 13, Selenium RC: Running HTML test suite contd... To run the test cases with Selenium RC, these test cases should be embedded in a test suite say Suite.html The suite can contain one or more test cases In order to run the HTML test suite, the Selenium RC server should be run. After downloading Selenium RC, extract it in some directory After extracting Selenium RC go to the Selenium RC Server folder where the executable jar - selenium-server.jar To run the jar, the system must contain Java jre version 1.4 or above.

May 13, Selenium RC: Running HTML test suite contd... The results of the execution of test gets store in some HTML file say results.html To run the HTML test suite with Selenium RC, type the command – java -jar selenium-server.jar -htmlsuite *iexplore /path/to/suite.html /path/to/results.htmlhttp:// This command runs all the test cases mentioned in suite.html and stores the results in results.html

May 13, Selenium: Disadvantages The Selenium remote control is quite slow at driving the browser It is possible to run only a limited number of concurrent tests on the same remote control server Selenium RC has a limitation in running tests in parallel If selenium fails to recognize objects, it cannot be assured of any add-ins which would be required Also Support provided for Selenium would be very less ( like in case of QTP, HP provides standard solutions and supports to issues)

May 13, Selenium: License All Selenium projects are licensed under the Apache 2.0 License. Apache license allows developer to contribute to the code This license also allows contributor to choose to distribute the Program in object code form under its own license agreement, with conditions. The complete license for Selenium can be found here: –

May 13, References Selenium Forums – – Selenium Commercial Support –

Thank You !