OnTestSucess is not working in TestNG Listeners | Selenium Forum
R
Rahul Kumar Posted on 03/04/2021

package listener;

import org.testng.ITestListener;
import org.testng.ITestResult;

public class MyTestNGListener implements ITestListener {

public void onTestFailure(ITestResult result) {
System.out.println("Test Failed");
System.out.println(result.getName());
System.out.println(result.getStatus());
System.out.println(result.getThrowable().getMessage());
}

public void onTestSucess(ITestResult result) {
System.out.println("Test Passed" + result.getName());
}

}


A
Ashish Replied on 10/04/2021

Plz register listener in tentng.xml

and run the test from testng.xml...

not a java file


R
Rahul Kumar Replied on 10/04/2021

Hi Ashish,

I have already registered listener in testng.xml because onTestFailure is working fine only I found issue in onTestSuccess.

Thanks

Rahul  


R
Rahul Kumar Replied on 10/04/2021

Also I am running the testng.xml


A
Ashish Replied on 13/04/2021

onTestSucess should be onTestSuccess


Related Posts