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 your approach clicking all the links which are available on the page?
Tell me how can we maximize browser window in selenium?
From your test script how you can create html test report?
Why should selenium be selected as a test tool?
When should I use Selenium IDE?
How you build object repository in your project?
What is selenium 2.0?
What is the selenium ide and what is it used for?
Can you use Selenium to test the Rest API or Web services?
How to locate a link using its text in selenium?
Explain what are the junits annotation linked with selenium?
How to hover the mouse on an element?
Explain what is the main difference between web-driver and rc?
Is there an htmlunitdriver for .net?
What difference do you make between soft vs. Hard to say in selenium?