Class AbstractTestFrameworkListener
- java.lang.Object
-
- com.testomatio.reporter.core.frameworkintegration.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected ResultConstructorresultConstructorprotected GlobalRunManagerrunManager
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTestFrameworkListener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidaddFrameworkSpecificData(TestResultWrapper.Builder builder, Object frameworkSpecificData)Adds framework-specific data to result wrapper builder.protected TestResultWrapperbuildTestRunResultHolder(TestMetadata metadata, String status, String message, Object frameworkSpecificData)Builds test result wrapper with framework-specific data.protected abstract ResultConstructorcreateResultConstructor()Creates framework-specific result constructor.protected TestResultcreateTestResult(TestMetadata metadata, String status, String message, Object frameworkSpecificData)Creates test case result using framework-specific constructor.protected voidhandleSuiteFinished(String suiteName)Handles test suite completion by decrementing suite counter.protected voidhandleSuiteStarted(String suiteName)Handles test suite start by incrementing suite counter.protected voidlogAndReportResult(TestResult result, String status, String message)Logs and reports test result to run manager.protected voidlogTestReporting(TestResult result, String status, String message)Logs test reporting details before submission.protected StringnormalizeStatus(Object frameworkStatus)Normalizes framework-specific status to standard format.protected voidreportTestResult(TestMetadata metadata, String status, Object frameworkSpecificData)Reports test result to Testomat.io.protected voidreportTestResult(TestMetadata metadata, String status, String message, Object frameworkSpecificData)Reports test result to Testomat.io with custom message.
-
-
-
Field Detail
-
runManager
protected final GlobalRunManager runManager
-
resultConstructor
protected final ResultConstructor resultConstructor
-
-
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 infostatus- 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 infostatus- test execution status (PASSED, FAILED, SKIPPED)message- optional custom message describing the resultframeworkSpecificData- 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 metadatastatus- test statusmessage- optional messageframeworkSpecificData- 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 metadatastatus- test statusmessage- optional messageframeworkSpecificData- 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 builderframeworkSpecificData- 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 reportstatus- test status for loggingmessage- optional message for logging
-
logTestReporting
protected void logTestReporting(TestResult result, String status, String message)
Logs test reporting details before submission.- Parameters:
result- test case resultstatus- test statusmessage- optional message
-
-