Class PerfectoLogExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.AfterTestExecutionCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.Extension

    public class PerfectoLogExtension
    extends Object
    implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterTestExecutionCallback
    • Constructor Detail

      • PerfectoLogExtension

        public PerfectoLogExtension()
    • Method Detail

      • beforeEach

        public void beforeEach​(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
                        throws Exception
        Executed before each test method.

        This method is executed before each individual test method and is responsible for retrieving tags and test name from the extension context and storing them in the thread-local store for later use in reporting.

        Specified by:
        beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
        Parameters:
        extensionContext - The ExtensionContext representing the current test context.
        Throws:
        Exception - if any error occurs during the execution of the method.
        Since:
        09.23
      • afterTestExecution

        public void afterTestExecution​(org.junit.jupiter.api.extension.ExtensionContext context)
                                throws Exception
        Executed after each test execution.

        This method is executed after test execution individual test method and is responsible for stopping the Perfecto Reportium test and reporting the test result (success or failure) based on the presence of an execution exception in the test context.

        Specified by:
        afterTestExecution in interface org.junit.jupiter.api.extension.AfterTestExecutionCallback
        Parameters:
        context - The ExtensionContext representing the current test context.
        Throws:
        Exception - if any error occurs during the execution of the method.
        Since:
        09.23
        See Also:
        StoreManager.getStore(StoreType.LOCAL_THREAD), Store.getValueFromStore(Object), ReportiumClient, TestResultFactory.createFailure(String), TestResultFactory.createSuccess()
      • setTagsAndTestName

        public static void setTagsAndTestName​(String[] tags,
                                              String testName)
        This function retrieves tags and a test name, storing them in the thread-local store for later use in reporting.
        Since:
        10.23
        See Also:
        StoreManager.getStore(StoreType.LOCAL_THREAD), Store.getValueFromStore(Object)