Automated Web App Performance Testing Using WebDriver


Published on

Published in: Technology

Automated Web App Performance Testing Using WebDriver

  1. 1. Web Performance Testingwith WebDriver Tools, Tips, and TechniquesMichael KlepikovMake the Web Faster Team,
  2. 2. Why is it important?■ +1s load => -7% conversion rate■ Just better user experience■ Mobile exacerbates slowness■ 46% mobile users abandon after 10s
  3. 3. Page Load performance■■ Waterfall chart■ Simulated latency■ Many iterations for statistical validity
  4. 4. Interactive scenarios■ Multi-page■ Login■ Ordering sequence■ AJAX is a better user experience
  5. 5. Marry WD + WebPageTest■ Use functional tests for performance■ Measure performance while test runs■ Not quite as trivial as it seems
  6. 6. WPT + WD Security■ Sandboxing Java is hard, JS is easy■ WebDriverJS FTW ○ NodeJS VM API■ Submit a WDJS script to WPT
  7. 7. Google Instant Search - WDJSdriver = new webdriver.Builder().build();driver.get(;driver.findElement( .sendKeys(webdriver);driver.findElement( .click();driver.wait(function() { return driver.getTitle();});
  8. 8. Google Instant Search - result
  9. 9. Measure around WD calls?■ Test-WD-browser: HTTP JSON RPC■ WD has 200ms wait loops■ Too granular, overhead, variability■ We want single-ms precision
  10. 10. Page self-instrumentation■ Frameworks exist ○ Boomerang, Episodes, others■ Page "calls home" with numbers■ Intercept these while the test runs ○ Parse from URLs in HAR
  11. 11. Surrogate instrumentation■ Post-process a HAR/Timeline■ Infer action boundaries■ Future: Resource/User Timings
  12. 12. Browser Standards■ Nav Timings in most major browsers■ Resource Timings -- not yet■ User Timings -- not yet■ Chrome DevTools Timeline■ Bowsers are moving fast...
  13. 13. Dos and Donts■ No WD within instrumented intervals■ Aggregate over multiple iterations!■ Run frontend in maximum isolation ○ Mock/stub/fake backends ○ Stable, repeatable results
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.