Introduction to Selenium
Jump to navigation
Jump to search
Day 1
Day 1 Agenda ⌘
- Why automation ?
- Selenium 1
- Exercise
- Selenium RC
- Architecture
- Exercise
- Limitations of Selenium RC
- Introduction to WebDriver
Selenium IDE ⌘
- Free Firefox plug-in
- Selenium IDE adds a layer of Record/Playback to Selenium.
- Provides the ability to debug test scripts.
- Auto complete common selenium commands
- Export tests in different formats like HTML,Ruby,Python,JUnit and so on
- Supports user extensions.
Exercise Selenium IDE ⌘
- Record a test
- Parametrize test
- Execute test
Exercise ⌘
- Open google in Firefox
- Open Selenium IDE,Tools -Selenium IDE
- Ensure that Selenium IDE is in recording mode
- Type “NobleProg” in the google search bar and click search
- On the search results verify that “NobleProg - Training Courses and Consultancy | NobleProg” is present.
- Save the test case as search_ide
- Run saved test case back again using the IDE
- View the results back in IDE
⌘
What are Limitations of Selenium IDE ?
Selenium Remote Control ⌘
- A server, written in Java and so available on all platforms.
- Acts as a proxy for web requests from them.
- Client libraries for many popular languages.
- Bundles Selenium Core and automatically loads into the browser.
Exercise – Selenium RC ⌘
- Import test scenario created in Exercise 1
- Any comfortable language
- Add the same to Development IDE
- Execute the test
- Parameterize test
⌘
Is Selenium RC better ?
Selenium RC Benefits ⌘
- Can be used for any Java Script Enabled browser.
- Have access to the complete features/libraries of the high level language
- Can be used to automate complex test cases.
- Makes it possible to create fast,robust and scalable automation.
Interesting Stuff ⌘
- Element Locators
- Based on Xpath, firepath is handy
- Based on DOM
- Element Filters
- Based on Index
- Based on value
- Regular Expression
- WaitForXXX, eval, screenshot and so on.
Selenium Remote Control ⌘
Selenium Present Problems ⌘
Test Automation Problems⌘
- What should be automated
- Who write automated tests
- When to stop automating
- For who are the automated tests
⌘
Any thoughts on how Selenium RC issues were Mitigated ???
New API - WebDriver ⌘
- To mitigate most of the issues Selenium RC had
- Selenium 2 Bindings along side Selenium 1
- One jar that holds the Selenium 1 Remote Control and the new Selenium Server.
⌘
What were the effects of Merge Any Thoughts ????
- ⌘
- Simpler API
- Speed
- Scalability
- Shared Javascript Atoms
- Previous client Languages still the same
⌘
Frameworks already on Selenium should we decommission them ??⌘==
Moving from 1 to 2⌘
WebDriverBackedSelenium
WebDriver driver = new FirefoxDriver(); Selenium sel = new WebDriverBackedSelenium(driver,”http://google.com”); selenium.open(“/”);
⌘
Selenium 2 Made Automation Easy
Day 2
Day 2 Agenda ⌘
- Design Tests
- Design Patterns and Development Strategies
- Cross browser Testing
- AJAX Applications
- Handling Alerts
- Windows Authentication
How to Avoid Ambiguous/Meaningless framework ⌘
Intent Action
Action ⌘
- Open http://gmail.com
- type 'User Id','someone@gmail.com'
- Type 'password','password123'
- ClickAndWait 'Log In'
Intent ⌘
- Login
- Change password
- Modify profile
- Log out
⌘
Write Intent Map to Actions
⌘
Seek High level abstractions
⌘
Hudson/Jenkins
↓
Ant/Maven
↓
JUnit/TestNG
↓
Business Specific Library of Functions
↓
Selenium
Start small ⌘
It'll get big anyway ⌘
What to start with ?⌘
- Smoke tests
- Revenue Paths
- New Features
- Sanity tests
Benefits from Short Tests ⌘
- Easier to read
- Easier to write
- Easier to debug/maintain
- Easier to parallelize
Links⌘
For more information