TestNG Tutorial #16 – How to Capture Screenshot for Failed Tests in TestNG

In this TestNG tutorial we will learn how to Capture Screenshot for Failed Tests in TestNG. TestNG provides @Listeners annotation to implement listeners in our test case and capture the screenshot on failure of any test case while test execution.

TestNG Tutorial #15 – What are TestNG Listeners

In this TestNG tutorial we will learn What are TestNG Listeners. TestNG provides @Listeners annotation to implement listeners in your test cases.

TestNG listeners listen to every event that occurs in the Selenium Test Case. Listeners modify the TestNG behavior which helps to redirect to new block of code based on certain events in your tests, for example, capture screenshot if test case failed.