Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Web performance testing with web driver

  • Login to see the comments

Web performance testing with web driver

  1. 1. Web Performance Testingwith WebDriverAn integrated approachMichael KlepikovMake the Web Faster Team, Googledevelopers.google.com/speedwebpagetest.org
  2. 2. ■ +1s load => -7% conversion rate■ Just better user experience■ Mobile exacerbates slowness■ 46% mobile users abandon after 10sWhy is it important?
  3. 3. ■ WebPageTest.org■ Waterfall chart■ Simulated latency■ Many iterations for statistical validityPage Load performance
  4. 4. Interactive scenarios■ Multi-page■ Login■ Placing an order■ AJAX is a better user experience
  5. 5. Test Systems Integration■ WebPageTest is a separate system■ Everyone has a custom toolchain■ Hard to integrate■ Not a seamless developer experience
  6. 6. ■ Standard WD API:○ Session Capabilities○ Logging■ Easy to enable in existing tests■ Fits well into existing toolchainsBuild it into WebDriver itself
  7. 7. ■ LoggingPreferencesin WD capabilities// Ask Chrome to collect "performance" logDesiredCapabilities caps = DesiredCapabilities.chrome();LoggingPreferences logPrefs = new LoggingPreferences();logPrefs.enable("performance", Level.INFO);caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);driver = new RemoteWebDriver("http://localhost:9515", caps);WD API: Create Driver
  8. 8. ■ Plain functional test, nothing special■ Free magic for developers!■ Pro tip: console.time()+timeEnd(), timeStamp()driver.get("http://www.google.com/");WebElement element = driver.findElement(By.name("q"));element.sendKeys("GTAC 2013");element.submit();WD API: Run Test
  9. 9. ■ Not part of test per se, inject:○ In tearDown()○ Override WebDriver.quit()○ WebDriver HTTP-JSON proxylog = driver.manage().logs().get("performance").getAll();for (LogEntry entry : log) {// WebDriver LogEntry message is a JSON stringJSONObject m = new JSONObject(entry.getMessage());... m.getString("webview") ... // Originating WebView id... m.getJSONObject("message") ... // Raw DevTools eventWD API: Get Performance Log
  10. 10. Performance Analysis
  11. 11. Demohttps://gist.github.com/klepikov/5457750
  12. 12. ■ No WD within instrumented intervals■ Aggregate over multiple iterations!■ Run frontend in maximum isolation○ Mock/stub/fake backends■ Use WebPageReplayStable Repeatable Results

×