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
What is selenium 2.0?
What’s selenese?
What are the programming languages supported by selenium webdiver?
What is selenium 3.0?
What is XPath? How does it work?
What are different forms of selenium?
What are the different Exceptions in selenium?
Explain what are the junits annotation linked with selenium?
Explain me how to check a checkbox in selenium?
What is parameterization in testng? How to pass parameters using testng.xml?
What is the reason to use the selenium grid?
Tell us how you can use recovery scenario with selenium?
Explain the different kinds of frameworks in automation?
How do you identify an object using selenium?
What is the difference between poi and jxl jar?