Class AbstractTestFrameworkListener

  • Direct Known Subclasses:
    CucumberListener, JunitExtension, TestNgListener

    public abstract class AbstractTestFrameworkListener
    extends Object
    Base class for test framework integrations with Testomat.io. Provides common functionality for JUnit, TestNG, and Cucumber listeners.
    • Constructor Detail

      • AbstractTestFrameworkListener

        protected AbstractTestFrameworkListener()
    • Method Detail

      • createResultConstructor

        protected abstract ResultConstructor createResultConstructor()
        Creates framework-specific result constructor.
        Returns:
        result constructor for the specific test framework
      • handleSuiteStarted

        protected void handleSuiteStarted​(String suiteName)
        Handles test suite start by incrementing suite counter.
        Parameters:
        suiteName - name of the starting test suite
      • handleSuiteFinished

        protected void handleSuiteFinished​(String suiteName)
        Handles test suite completion by decrementing suite counter.
        Parameters:
        suiteName - name of the finished test suite
      • reportTestResult

        protected void reportTestResult​(TestMetadata metadata,
                                        String status,
                                        Object frameworkSpecificData)
        Reports test result to Testomat.io.
        Parameters:
        metadata - test metadata containing title, ID, and suite info
        status - test execution status (PASSED, FAILED, SKIPPED)
        frameworkSpecificData - framework-specific test data
      • reportTestResult

        protected void reportTestResult​(TestMetadata metadata,
                                        String status,
                                        String message,
                                        Object frameworkSpecificData)
        Reports test result to Testomat.io with custom message.
        Parameters:
        metadata - test metadata containing title, ID, and suite info
        status - test execution status (PASSED, FAILED, SKIPPED)
        message - optional custom message describing the result
        frameworkSpecificData - framework-specific test data
      • createTestResult

        protected TestResult createTestResult​(TestMetadata metadata,
                                              String status,
                                              String message,
                                              Object frameworkSpecificData)
        Creates test case result using framework-specific constructor.
        Parameters:
        metadata - test metadata
        status - test status
        message - optional message
        frameworkSpecificData - framework-specific data
        Returns:
        constructed test case result
      • buildTestRunResultHolder

        protected TestResultWrapper buildTestRunResultHolder​(TestMetadata metadata,
                                                             String status,
                                                             String message,
                                                             Object frameworkSpecificData)
        Builds test result wrapper with framework-specific data.
        Parameters:
        metadata - test metadata
        status - test status
        message - optional message
        frameworkSpecificData - framework-specific data
        Returns:
        configured test case result wrapper
      • addFrameworkSpecificData

        protected abstract void addFrameworkSpecificData​(TestResultWrapper.Builder builder,
                                                         Object frameworkSpecificData)
        Adds framework-specific data to result wrapper builder.
        Parameters:
        builder - result wrapper builder
        frameworkSpecificData - framework-specific data to add
      • logAndReportResult

        protected void logAndReportResult​(TestResult result,
                                          String status,
                                          String message)
        Logs and reports test result to run manager.
        Parameters:
        result - test case result to report
        status - test status for logging
        message - optional message for logging
      • logTestReporting

        protected void logTestReporting​(TestResult result,
                                        String status,
                                        String message)
        Logs test reporting details before submission.
        Parameters:
        result - test case result
        status - test status
        message - optional message
      • normalizeStatus

        protected String normalizeStatus​(Object frameworkStatus)
        Normalizes framework-specific status to standard format.
        Parameters:
        frameworkStatus - framework-specific status object
        Returns:
        normalized status (PASSED, FAILED, or SKIPPED)