Package testUtils

Class TestResultLoggerListener

java.lang.Object
testUtils.TestResultLoggerListener
All Implemented Interfaces:
org.testng.ITestListener, org.testng.ITestNGListener

public class TestResultLoggerListener extends Object implements org.testng.ITestListener
TestNG listener that logs test execution events using Log4j2.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onTestFailure(org.testng.ITestResult result)
    Called when a test method fails.
    void
    onTestSkipped(org.testng.ITestResult result)
    Called when a test method is skipped.
    void
    onTestStart(org.testng.ITestResult result)
    Called when a test method starts.
    void
    onTestSuccess(org.testng.ITestResult result)
    Called when a test method passes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.testng.ITestListener

    onFinish, onStart, onTestFailedButWithinSuccessPercentage, onTestFailedWithTimeout

    Methods inherited from interface org.testng.ITestNGListener

    isEnabled
  • Constructor Details

    • TestResultLoggerListener

      public TestResultLoggerListener()
  • Method Details

    • onTestStart

      public void onTestStart(org.testng.ITestResult result)
      Called when a test method starts. Logs the method name and parameters.
      Specified by:
      onTestStart in interface org.testng.ITestListener
      Parameters:
      result - the test result
    • onTestSuccess

      public void onTestSuccess(org.testng.ITestResult result)
      Called when a test method passes. Logs the method name.
      Specified by:
      onTestSuccess in interface org.testng.ITestListener
      Parameters:
      result - the test result
    • onTestFailure

      public void onTestFailure(org.testng.ITestResult result)
      Called when a test method fails. Logs the method name and throwable.
      Specified by:
      onTestFailure in interface org.testng.ITestListener
      Parameters:
      result - the test result
    • onTestSkipped

      public void onTestSkipped(org.testng.ITestResult result)
      Called when a test method is skipped. Logs the method name.
      Specified by:
      onTestSkipped in interface org.testng.ITestListener
      Parameters:
      result - the test result