package test.template.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.ITestResult;
import org.testng.TestListenerAdapter;

public class TakeScreenshotOnFailureListener extends TestListenerAdapter {

	private static final Logger log = LoggerFactory.getLogger(TakeScreenshotOnFailureListener.class);
	
	@Override
	public void onTestFailure(ITestResult tr) {
		super.onTestFailure(tr);
		log.info("Test Fail: " + tr);
		String file = SeleniumUtils.takeScreenShot();
		tr.setAttribute("screenshot", SeleniumUtils.SCREENSHOT_PATH + file);
	}

}

@@ -454,16 +454,44 @@
 : %22 + tr
+.getMethod().getMethodName()
 );%0D%0A%09%09St

Update listener