Software Automation Testing Training Toronto
What is Selenium ?
Automation tool for web based applications
Used for functional regression testing
Uses JavaScript
Embeds test automation engine in your browser
Selenium Components
Core engine of Selenium
JavaScript/DHTML library
Other Selenium components such as IDE and RC build on it
Supports a variety of platforms
Windows: Internet Explorer 6.0 and 7.0 , FireFox 0.8 to 2.0 Mac
OS X: Safari 2.0.4+, FireFox 0.8 to 2.0 , Camino 1.0a1 Linux:
FireFox 0.8 to 2.0 Konqueror
Advantages of Selenium
Open source, free software
Easy Installation
Scripting Techniques :
Easy recording and playback of scripts Modular scripts
Compatibility :
Multiple operating systems (Windows, Linux, Mac)
Allows cross browser testing (Record in FireFox, execute in IE)
No dedicated machine required for test execution (user can Work in parallel).
Integration with third party tools.
Example : RTH Test Case Management Tool.
Selenese-The language of Selenium
Selenese consists of Actions, Accessors, Element Locators and Variables
• Actions - Commands for the selenese language to perform action on a web application
Script performs a particular action
Typically take element locator and possibly a value Examples :
1.Open- open a url
2.Click- click button, link, etc..
3.Type- type text in text field
Sample Script
require "selenium"
require "test/unit"
def test_new
@selenium.open "/"
@selenium.type "q", "Hello" @selenium.click "btnG"
@selenium.wait_for_page_to_load "30000" begin
assert @selenium.is_text_present("Hello is a new way to look at pictures with friends and family. )
rescue Test::Unit::AssertionFailedError @verification_errors << $!
end
temp = @selenium.get_text("//div[2]/div[1]")
end
end
Automating Tests using Selenium
Prerequisites and Test Bed Setup
Software :
Selenium IDE, Mozilla FireFox for script recording Selenium Server, Java for running scripts
Configuration :
Set path variables
Use -multiWindow option while starting server
Resource :
Users… should have basic scripting knowledge
Hardware… No specific requirement the basic configuration for a server -
P4, 512 MB RAM is good enough.
Scripting Techniques and Best Practices
In order to ensure the quality of scripts and reduce maintenance, it is
best to have scripting techniques and best practices. Some of which are…
Comments and proper formatting in scripts
Scripting considerations for integration with other tools
Documentation of basic data required for scripts
Documentation of new functions added for scripts
Follow fixed, logical scripting format
Include code to handle Selenium errors
Scripting according to application specific issues
Handling of Popup windows
Steps :
Window id required for automated operations in window
At times if id is not obtained during recording, go to window and perform operations
Window id will be obtained after this action.
Handling of Frames
Option :
-multiWindow option handles potential frame problems
Causes :
At times required name of frame not obtained in recording
Fix :
Obtain frame label from source code
Also can be obtained from browser URL bar
Benefits to Organization
Automation Benefits :
Usual benefits for automation e.g. Time saving
Time required for sanity reduced ( 12 man hours to 3 man hours, build frequency of 4-5 builds a month )
For one of the projects, Sanity suite automated : 243 test cases
Good Returns on Zero Investment
Increasing Productivity
Cost saving as it is open-source
QA engineers get familiar with scripting languages like Ruby, Perl etc apart from manual testing
Caveat:
Full automation and maintenance has not been evaluated and that can be a risk
Drawbacks
Lack of exhaustive formal guidance material
Mozilla FireFox browser is required for script recording
Only works with web based applications
Stepin2IT
100 Westmore Drive
Etobicoke, ON M9V5C3
Toronto (CANADA)
Phone:
+416-743-6333 www.stepin2it.com