January 2018
Beginner to intermediate
354 pages
7h 59m
English
There are many ways to capture and name the image of the screen. Using the test method name and a timestamp for the image name is a common practice. This aligns the captured screens with the test methods that created them, putting a date on the filename, and so on:
/** * screenShot - method that takes iTestResult as parameter * * @param result - The result of test * @return String */public static String screenShot(ITestResult result) throws Exception { DateFormat stamp = new SimpleDateFormat("MM.dd.yy.HH.mm.ss"); Date date = new Date(); ITestNGMethod method= result.getMethod(); String testName = method.getMethodName(); return captureScreen(testName + "_" + stamp.format(date) + ".png");}
/** * captureScreen - method ...
Read now
Unlock full access