Web Performance Report Using Y-Slow Tool along with Selenium
Web page performance and its causes can be monitored by using Y-slow, a tool which analyses web pages and using a set of rules provides suggestions on how to improve the web page performance.
Manually setting preferences for Y-slow:
- Open Firefox browser and type about:config
- Search for Y-slow and set the below preferences:extensions.yslow.beaconUrl = http://www.showslow.com/beacon/yslow/
extensions.yslow.beaconInfo = grade
extensions.yslow.optinBeacon = true
extensions.yslow.autorun = true
- Now open the Firefox browser and navigate to any web page.
- Open “http://www.showslow.com” and move to the page under “Last Measurements” tab.
- The URL for your web application and the Y-slow grade would be present in the table. Click on the URL to view the report of your web page.
Setting preferences from Selenium:
- Add the .xpi file for firebug.
File firebug = new File(“Path to:\\firebug@software.joehewitt.com.xpi“);
- Add the .xpi file for Y-slow.
File yslow = new File(“Path to:\\yslow@yahoo-inc.com.xpi“); - Create a firefox profile.
FirefoxProfile profile = new FirefoxProfile(); - Add the firebug extension.
profile.addExtension(firebug); - Add the firebug preferences.
profile.setPreference(“extensions.firebug.currentVersion”, “2.0”);
profile.setPreference(“extensions.firebug.addonBarOpened”, true);
profile.setPreference(“extensions.firebug.console.enableSites”, true);
profile.setPreference(“extensions.firebug.script.enableSites”, true);
profile.setPreference(“extensions.firebug.net.enableSites”, true);
profile.setPreference(“extensions.firebug.previousPlacement”, 1);
profile.setPreference(“extensions.firebug.allPagesActivation”, “on”);
profile.setPreference(“extensions.firebug.onByDefault”, true);
profile.setPreference(“extensions.firebug.defaultPanelName”, “net”);
- Add the yslow extension.
profile.addExtension(yslow); - Then set the yslow preferences.
profile.setPreference(“extensions.yslow.beaconUrl”, “http://www.showslow.com/beacon/yslow/ “);
profile.setPreference(“extensions.yslow.beaconInfo”,”grade”);
profile.setPreference(“extensions.yslow.optinBeacon”,true);
profile.setPreference(“extensions.yslow.autorun”,true); - Add the capabilities.
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName(“firefox”);
capabilities.setPlatform(org.openqa.selenium.Platform.ANY);
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
WebDriver driver = new FirefoxDriver(capabilities);
- Navigate to your application web page using selenium.
- Open “http://www.showslow.com” and move to the page under “Last Measurements” tab for the reports.
Written By: – Jaya Mohanty, QA Engineer, Mindfire Solutions
Posted on April 8, 2014, in Automation Testing, Performance Testing, Selenium Testing and tagged Jaya Mohanty, Mindfire Solutions, performance report, performance report using YSlow, Performance Testing, QA Engineer, selenium test automation, Selenium Testing, selenium testing services, selenium web app testing, selenium web application testing, selenium web testing, selenium website testing, Testing with YSlow tool, Web page performance testing, YSlow tool. Bookmark the permalink. 1 Comment.
Pingback: Testing Bits – 4/6/14 – 4/12/14 | Testing Curator Blog