How To Get The Execution Time Of Multiple Methods In Selenium Java? | Devstringx Technologies

import org.apache.commons.lang.time.StopWatch;import org.testng.Reporter;public class stopwatchtime extends StopWatch {static StopWatch stopwatch = new StopWatch();public static void timetaken(){long x = stopwatch.getTime();// Convert the result to a stringString numberAsString = Long.toString(x);System.out.println(“Execution time for this method- ” +numberAsString+ ” milliseconds \n”);Reporter.log(“Time taken to execute this method- “+numberAsString+” milliseconds \n” );}public static void start(String methodname) {stopwatch.start();Reporter.log(methodname+”; \n”);}public static void stop(String methodname) {stopwatch.stop();Reporter.log(methodname+ “; \n”);}public static void reset(String methodname) {stopwatch.reset();Reporter.log(methodname+”; \n”);}}}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store