adspace


How to capture the screenshot of failed testcase only among a set of testcases?

Answer Posted / suresh vemula

First we have to create a method of screen shot using java.

After that we have annotation in testng to identify the failure test case or methods using "iTestResult"

This iTestResult using only where annotation in aftermethod

@Aftermethod
Public void test(iTestResult.FAILURE==result.getStatus()){

Utility.screenshot(driver,result.getname());
}

Here utility.screenshot is java class to created for screenshot

Here getName() returns the failure test case name
Then you have to identify the failure test easily

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what will be the first salary and what will be the hike in the salary?

929


Do you know how to locate a link using its text in selenium?

985


Have you created any framework?

1038


What’s selenese?

920


How can you fetch an attribute from an element? How to retrieve typed text from a textbox?

1197