Selenium in real-world projects: Automated testing for web applications

7,546 views
7,443 views

Published on

Selenium (http://selenium.openqa.org/) is a tool which allows web developers to run automatic functional tests on their applications. This presentation gives motivation for automated regression testing of web applications, and shows how Selenium can be integrated into a continuous build process.

Published in: Technology, Education
1 Comment
8 Likes
Statistics
Notes
  • Question on the last slide - how can Selenium be used to detect memory leaks?

    I am investigating this (by having Selenium Core make a URL request to a python web-server that runs a task manager), but am finding that Selenium itself leaks memory, making it difficult to measure the underlying application
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
7,546
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
564
Comments
1
Likes
8
Embeds 0
No embeds

No notes for slide

Selenium in real-world projects: Automated testing for web applications

  1. 1. Selenium in real world projects Automated testing of web applications Martin Kleppmann Ept Computing | www.eptcomputing.com
  2. 2. Deploying a new release http://flickr.com/photos/josa/124264708/ (creative commons)
  3. 3. http://flickr.com/photos/dennissylvesterhurd/200001422/ (creative commons)
  4. 4. Selenium
  5. 5. Model-View-Controller Controller Unit testing Request Client Model DB Response View
  6. 6. Build cycle Checkout latest version Run unit/model tests Migrate staging database 10 mins Deploy to staging server Fill database with example data Render lots of views: wget -r Run Selenium scripts Notify us of outcome
  7. 7. Model-View-Controller Selenium testing Controller Unit testing Request Client Model DB Response View wget -r
  8. 8. Functional stack Rendering on screen DOM (Document tree) Selenium HTML wget -r HTTP Web framework Model test Database
  9. 9. Sample script # User is not logged in. Searches for auction and chooses it in the listing selenium.type quot;search_queryquot;, quot;seleniumquot; selenium.click quot;commitquot; selenium.wait_for_page_to_load quot;30000quot; selenium.click quot;link=Selenium test auction, single lot, normal+buy nowquot; selenium.wait_for_page_to_load quot;30000quot; # User places a bid of 12 pounds (below the reserve price) selenium.type quot;bid_max_price_vattedquot;, quot;12quot; selenium.click quot;bid_submitquot; selenium.wait_for_page_to_load quot;30000quot; # User logs in as Adalbert selenium.type quot;loginquot;, quot;adalbertquot; selenium.type quot;passwordquot;, quot;asdfquot; selenium.click quot;commitquot; selenium.wait_for_page_to_load quot;30000quot; # Bid confirmation page selenium.click quot;bid_submitquot; selenium.wait_for_page_to_load quot;30000quot; # Redirected to auction page - check Adalbert is losing assert selenium.is_text_present(quot;You are losing your bid on this auctionquot;) assert selenium.is_text_present(quot;below the seller's reserve pricequot;)
  10. 10. Demo
  11. 11. Selenium strong points • Simple and powerful DOM-level testing • Fairly stable – ok for continuous integration • Ajax-heavy apps (cross-browser issues) • Testing typical user flows • Good fit with Agile et al. • Open Source
  12. 12. Selenium weak points • Fiddly setup, platform maintenance • Tedious error diagnosis • Valid UI changes may break test • Rendering tests limited • Interaction with Flash • Slow; concurrency problematic • Heavily dependent on state – generate data
  13. 13. The future • “Selenium on demand” service – “rent a web browser”, large choice of platforms • Acceptance testing; testing impact of ads • Memory leak detection • Access to email in tests • etc...

×