Class JunitExtension
- java.lang.Object
-
- com.testomatio.reporter.core.frameworkintegration.AbstractTestFrameworkListener
-
- com.testomatio.reporter.core.frameworkintegration.JunitExtension
-
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback,org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.TestWatcher
public class JunitExtension extends AbstractTestFrameworkListener implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.TestWatcher
JUnit 5 extension for Testomat.io integration. Reports JUnit test execution results to Testomat.io platform. Usage: Add@ExtendWith(JUnitExtension.class)to test classes.
-
-
Field Summary
-
Fields inherited from class com.testomatio.reporter.core.frameworkintegration.AbstractTestFrameworkListener
resultConstructor, runManager
-
-
Constructor Summary
Constructors Constructor Description JunitExtension()Creates new JUnit extension.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddFrameworkSpecificData(TestResultWrapper.Builder builder, Object frameworkSpecificData)Adds framework-specific data to result wrapper builder.voidafterAll(org.junit.jupiter.api.extension.ExtensionContext context)Called after all tests in a class.voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext context)Called before all tests in a class.voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext)Called before each test method execution.protected ResultConstructorcreateResultConstructor()Creates framework-specific result constructor.voidtestAborted(org.junit.jupiter.api.extension.ExtensionContext context, Throwable cause)Called when a test is aborted.voidtestDisabled(org.junit.jupiter.api.extension.ExtensionContext context, Optional<String> reason)Called when a test is disabled.voidtestFailed(org.junit.jupiter.api.extension.ExtensionContext context, Throwable cause)Called when a test fails.voidtestSuccessful(org.junit.jupiter.api.extension.ExtensionContext context)Called when a test completes successfully.-
Methods inherited from class com.testomatio.reporter.core.frameworkintegration.AbstractTestFrameworkListener
buildTestRunResultHolder, createTestResult, handleSuiteFinished, handleSuiteStarted, logAndReportResult, logTestReporting, normalizeStatus, reportTestResult, reportTestResult
-
-
-
-
Method Detail
-
createResultConstructor
protected ResultConstructor createResultConstructor()
Description copied from class:AbstractTestFrameworkListenerCreates framework-specific result constructor.- Specified by:
createResultConstructorin classAbstractTestFrameworkListener- Returns:
- result constructor for the specific test framework
-
addFrameworkSpecificData
protected void addFrameworkSpecificData(TestResultWrapper.Builder builder, Object frameworkSpecificData)
Description copied from class:AbstractTestFrameworkListenerAdds framework-specific data to result wrapper builder.- Specified by:
addFrameworkSpecificDatain classAbstractTestFrameworkListener- Parameters:
builder- result wrapper builderframeworkSpecificData- framework-specific data to add
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
Called before all tests in a class. Starts test suite tracking.- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback- Parameters:
context- JUnit extension context
-
afterAll
public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context)
Called after all tests in a class. Finishes test suite tracking.- Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback- Parameters:
context- JUnit extension context
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
Called before each test method execution.- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Parameters:
extensionContext- JUnit extension context
-
testDisabled
public void testDisabled(org.junit.jupiter.api.extension.ExtensionContext context, Optional<String> reason)Called when a test is disabled. Reports test as skipped.- Specified by:
testDisabledin interfaceorg.junit.jupiter.api.extension.TestWatcher- Parameters:
context- JUnit extension contextreason- optional reason for disabling the test
-
testSuccessful
public void testSuccessful(org.junit.jupiter.api.extension.ExtensionContext context)
Called when a test completes successfully. Reports test as passed.- Specified by:
testSuccessfulin interfaceorg.junit.jupiter.api.extension.TestWatcher- Parameters:
context- JUnit extension context
-
testAborted
public void testAborted(org.junit.jupiter.api.extension.ExtensionContext context, Throwable cause)Called when a test is aborted. Reports test as skipped.- Specified by:
testAbortedin interfaceorg.junit.jupiter.api.extension.TestWatcher- Parameters:
context- JUnit extension contextcause- exception that caused the abort
-
testFailed
public void testFailed(org.junit.jupiter.api.extension.ExtensionContext context, Throwable cause)Called when a test fails. Reports test as failed.- Specified by:
testFailedin interfaceorg.junit.jupiter.api.extension.TestWatcher- Parameters:
context- JUnit extension contextcause- exception that caused the failure
-
-