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 is your approach clicking all the links which are available on the page?

504


Tell me how can we maximize browser window in selenium?

455


From your test script how you can create html test report?

481


Why should selenium be selected as a test tool?

572


When should I use Selenium IDE?

542






How you build object repository in your project?

517


What is selenium 2.0?

684


What is the selenium ide and what is it used for?

557


Can you use Selenium to test the Rest API or Web services?

502


How to locate a link using its text in selenium?

547


Explain what are the junits annotation linked with selenium?

493


How to hover the mouse on an element?

498


Explain what is the main difference between web-driver and rc?

462


Is there an htmlunitdriver for .net?

566


What difference do you make between soft vs. Hard to say in selenium?

490