Performance Testing using Selenium Webdriver
Yes we know that Selenium Webdriver is a functional testing tool and is not a recommended option to do performance! But then there are times that you want to just do a quick performance check and find the bottlenecks in your application, here is how:
The solutions here are organised based on the complexity and detail you want to achieve:
Solution 1: Measuring performance using a Timer in Selenium WebDriver
We can use the the StopWatch class for measuring the time taken for the page to load or any inbuilt date time calendar feature:
StopWatch pageLoad = new StopWatch();
pageLoad.start();
//Perform your test
pageLoad.stop();
System.out.println("Total Page Load Time: " + pageLoad.getTime() + "milliseconds");
Or
Calendar cal = Calendar.getInstance();
Date d1 = cal.getTime();
//Perform your test
Calendar cal2 = Calendar.getInstance();
Date d2 = cal2.getTime();
long diff = d2.getTime() - d1.getTime();
long diffSeconds = diff / 1000 % 60;
long diffMinutes = diff / (60 * 1000) % 60;
System.out.println("Execution Time:",diffMinutes+" minute and "+diffSeconds+"seconds"););
JavascriptExecutor js = (JavascriptExecutor) driver;
long navigationStart = (Long) js.executeScript
("return window.performance.timing.navigationStart;");
//Perform your test
long loadEventEnd = (Long) js.executeScript
("return window.performance.timing.loadEventEnd;");
System.out.println
("Page Load Time is " + (loadEventEnd - navigationStart)/1000 + " seconds.");
Solution 3: Measuring performance with JMeterhttp://seleniummaster.com/sitecontent/index.php/performance-test-menu/selenium-load-test-menu
Solution 4: Measuring performance with Firebug's Net panel
http://www.softwareishard.com/blog/firebug/automate-page-load-performance-testing-with-firebug-and-selenium/
Hope that helps someone playing with Selenium WebDriver and trying to achieve some basic performance testing!
Thank you so much for this nice information. Hope so many people will get aware of this and useful as well. And please keep update like this.
ReplyDeleteGame QA Solutions
PC Game Testing Services
Great!! Thank you for sharing this post on software testing. Software testing outsourcing services are in great demand these days. Good to see such nice articulated post.
ReplyDeleteThanks for sharing,this blog makes me to learn new thinks.
ReplyDeleteinteresting to read and understand.keep updating it.
call girls in dehradun
escort service in dehradun
ReplyDeleteThanks for sharing,this blog makes me to learn new thinks.
interesting to read and understand.keep updating it.
call girls in ghaziabad
escort service in ghaziabad
ReplyDeleteThanks for sharing,this blog makes me to learn new thinks.
interesting to read and understand.keep updating it.
call girls in gurgaon
escort service in gurgaon
Great post, Selenium is an open-source, test automation tool that has become an important automation tool in the software quality assurance world. This selenium testing tool consists of a different set of tools which include Selenium WebDriver, Selenium RC, Selenium IDE, and Selenium Grid, all of which have different features. Selenium testing tool is a lightweight tool and is developer-friendly, commonly used for automating web applications.
ReplyDeleteyou could try here my sources web continue reading this More hints other
ReplyDelete