Build it with us!Build it with us! CDs with the required files on them are being passed around Also...
-
Upload
america-leaper -
Category
Documents
-
view
218 -
download
1
Transcript of Build it with us!Build it with us! CDs with the required files on them are being passed around Also...
![Page 1: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/1.jpg)
Automated Web Performance Testing
Before 5pm
Ian WhiteMark WatsonSimon Nicoud
![Page 2: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/2.jpg)
Build it with us!
CD’s with the required files on them are being passed around
Also available here, bandwidth permitting:http://bit.ly/llxuoe
![Page 3: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/3.jpg)
Agenda
Automated web performance testing?
Tools needed to automate web testing
Tools used to gather Performance Metrics
Combine the two
5pm!
![Page 4: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/4.jpg)
End Goal
![Page 5: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/5.jpg)
What is automated web performance testing?
![Page 6: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/6.jpg)
Why?
![Page 7: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/7.jpg)
Tools:
Browser automation software Selenium (Watir, QTP, Silk Performer…)
Metrics gathering software BrowserMob Proxy (Fiddler, Web/Resource
Timings…)
HAR Viewer – Metrics displaying software
![Page 8: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/8.jpg)
Workshop Setup
Tutorials are provided in Python & Java Selenium to automate Firefox Then later use Proxy to gather page metrics
If you get lost check the READMEs!
![Page 9: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/9.jpg)
Workshop Setup
Uses Firefox
Python Examples Setup Python Setup Selenium lib Run example
![Page 10: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/10.jpg)
Workshop Setup
Java Examples Requires JDK
Selenium lib in jars/
Use runtest.sh/bat to run
README lists examples
![Page 11: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/11.jpg)
Examples
Basic Selenium script
Selenium script in a unit test
Timings and Timeouts per step
![Page 12: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/12.jpg)
Basic Selenium script
Python:
from selenium import webdriver
driver = webdriver.Firefox()driver.get("http://www.google.com")element = driver.find_element_by_name("q")element.send_keys("Cheese!")element.submit()driver.close()
![Page 13: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/13.jpg)
Selenium unit test
Python:
def testSearch(self): google = self.driver.get("http://www.google.com") element = self.driver.find_element_by_name("q") element.send_keys("Cheese!") element.submit()
![Page 14: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/14.jpg)
Timings and Timeouts
Python:
def testSearch(self): with Timeout(10, "Navigate to google.com"): self.driver.get("http://www.google.com")
with Timeout(10, "Search for cheese!"): element =self.driver.find_element_by_name("q") element.send_keys("Cheese!") element.submit()
![Page 15: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/15.jpg)
HAR
HTTP Archive Simple format (JSON/JSONP) Tons of data (if you want it) Easily extensible Becoming the standard
![Page 16: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/16.jpg)
HAR Tools
![Page 17: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/17.jpg)
Harpoon
Store/analyze performance test results (HAR)
Open Source Guice Sitebricks MongoDB Jetty
Built in a day (sort of)
Source code available: https://github.com/fuzzygroove/harpoon
![Page 18: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/18.jpg)
Harpoon
http://labs.webmetrics.com:8080/
![Page 19: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/19.jpg)
Which Metrics?
Overall page load time
DOM loading/interactive/complete, browser 1st render, …
Per-item timings
Headers, status codes, and content
![Page 20: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/20.jpg)
Methods for gathering metrics
Setting your own timings in test code
Using the new ‘Navigation.Timings’ or Web Timings standard built into browsers
Using browser plugins that report back the timings to you, e.g. WebPageTest
Routing the browser traffic through a local proxy and gathering the statistics from there.
Network traffic capture
![Page 21: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/21.jpg)
Web Timings
Currently Chrome and IE9 supported, coming soon for firefox
http://w3c-test.org/webperf/specs/NavigationTiming/
![Page 22: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/22.jpg)
Unfortunately it doesn't give timings per item downloaded, e.g. images, css, js, ....
![Page 23: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/23.jpg)
Browser Plugins
Firefox - Firebug Net Panel + NetExport https://github.com/lightbody/browsermob-pag
e-perf https://github.com/AutomatedTester/Automate
dTester.PagePerf.git
![Page 24: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/24.jpg)
Capturing page metrics using a proxy
Many available, but few capture metrics in a convenient way Two good ones we’ll be looking at:
BrowserMob Proxy Fiddler
![Page 25: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/25.jpg)
Advantages of using a Proxy
Works with any browser that allows setting a proxy
Testing benefits beyond performance monitoring Blacklisting/whitelisting URLs URL rewrites Make sure specific URLs are visited
![Page 26: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/26.jpg)
Advantages of using a Proxy
Header changes Set the user agent manually to test different browser
behavior Auto authentication
Wait until all content is downloaded HTTP idle for X seconds
Simulate limited bandwidth
![Page 27: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/27.jpg)
BrowserMob Proxy
Open source cross platform proxy HTTP Archive support Native Java API REST API for calling from other languages
Source code available: https://github.com/lightbody/browsermob-proxy
![Page 28: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/28.jpg)
BrowserMob Proxy
Java Examples: Write out HTTP Archive file
Separate pages in the HAR
proxy.newHar(“Main Page”); ...load main page... proxy.endPage(); proxy.newPage(”Login"); ...login... proxy.endPage();
proxy.getHar().writeTo(new File("test.har"));
![Page 29: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/29.jpg)
BrowserMob Proxy
Redirecting URLs
proxy.blacklistRequests(regex, responseCode)proxy.whitelistRequests(regex, responseCode)
Blacklist/Whitelist URLs
proxy.rewriteUrl(regex, replace)
Limit Bandwidth
proxy.setDownstreamKbps(kbps)proxy.setUpstreamKbps(kbps)
![Page 30: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/30.jpg)
BrowserMob Proxy
Python Demo: First, start the proxy:
Then, run the examples:
![Page 31: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/31.jpg)
BrowserMob Proxy
Selenium test with HAR export
![Page 32: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/32.jpg)
BrowserMob Proxy
Whitelist example Compare site load time with and
without 3rd party content
![Page 33: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/33.jpg)
BrowserMob Proxy
Limit Bandwidth Compare site load time with different
bandwidth restrictions
![Page 34: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/34.jpg)
BrowserMob Proxy
HAR upload Last example uploads results of each test to
central server.
![Page 35: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/35.jpg)
Optimize for Testing
Dumb stuff Don’t use nested iframes Avoid popups
Tough stuff Dynamic elements Embedded objects Mobile
Good stuff Automated test framework Continuous Integration
![Page 36: Build it with us!Build it with us! CDs with the required files on them are being passed around Also available here, bandwidth permitting: .](https://reader035.fdocuments.us/reader035/viewer/2022062417/5518c432550346991f8b5702/html5/thumbnails/36.jpg)
Links
BrowserMob proxy https://github.com/lightbody/browsermob-proxy
Harpoon https://github.com/fuzzygroove/harpoon
Examples from this talk https://github.com/watsonmw/automated-pageloadmetrics
Simon Nicoud: [email protected] - @simonnicoud Ian White: [email protected] - @impressiverMark Watson: [email protected] - @watsonmw