Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 me how many types of webdriver apis are available in selenium?

893


How to scroll down to a particular element?

3627


Why should selenium be selected as a test program?

1024


what is the difference between 2.0 & 3.0

1625


How can you handle network latency using selenium?

1011


Tell us how can you run selenium server other than the default port 4444?

913


What is the function of xpath?

947


Explain what are the different types of locators in selenium?

1041


What are the different ways of locating a web element in selenium?

894


What is a node in selenium grid?

1006


Tell me how can we launch different browsers in selenium webdriver?

913


How to check if a button is enabled on the page?

923


Tell me what api is required for database testing in selenium webdriver?

919


Name an api used for logging in java?

924


What is the difference between selenium ide, selenium rc, and webdriver?

1022