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

Explain Cucumeber Framework?

561


What is the difference b/w close () and quit ()?

660


What is the syntax of finding elements by id using css selector?

567


How to handle keyboard and mouse actions using selenium?

561


How do you upload a file?

611






What is datadriven framework and keyword driven?

603


What is selenium 2.0?

761


How you can find broken images in a page using selenium web driver?

560


What is selenium? What are the different selenium components?

567


Which are the operating systems supported by selenium?

567


What is the difference between MaxSessions vs. Selenium grid MaxInstances properties?

680


How many types of locators are there in selenium?

550


How to handle dropdowns in selenium?

705


What are the locators available in selenium?

642


What are the advantages of automation framework?

571