Class AllureJunitPlatform

java.lang.Object
io.qameta.allure.junitplatform.AllureJunitPlatform
All Implemented Interfaces:
org.junit.platform.launcher.TestExecutionListener

public class AllureJunitPlatform extends Object implements org.junit.platform.launcher.TestExecutionListener
Reports JUnit Platform execution to Allure.

Register this listener with the JUnit Platform launcher to translate test plan, container, test, fixture, report-entry, and failure events into Allure results. It is the core listener used by Platform-based Allure adapters.

  • Field Details

    • ALLURE_REPORT_ENTRY_BLANK_PREFIX

      public static final String ALLURE_REPORT_ENTRY_BLANK_PREFIX
      Configuration key for allure report entry blank prefix.
      See Also:
    • ALLURE_PARAMETER

      public static final String ALLURE_PARAMETER
      Configuration key for allure parameter.
      See Also:
    • ALLURE_PARAMETER_VALUE_KEY

      public static final String ALLURE_PARAMETER_VALUE_KEY
      Configuration key for allure parameter value key.
      See Also:
    • ALLURE_PARAMETER_MODE_KEY

      public static final String ALLURE_PARAMETER_MODE_KEY
      Configuration key for allure parameter mode key.
      See Also:
    • ALLURE_PARAMETER_EXCLUDED_KEY

      public static final String ALLURE_PARAMETER_EXCLUDED_KEY
      Configuration key for allure parameter excluded key.
      See Also:
    • ALLURE_FIXTURE

      public static final String ALLURE_FIXTURE
      Configuration key for allure fixture.
      See Also:
    • PREPARE

      public static final String PREPARE
      Constant value for prepare.
      See Also:
    • TEAR_DOWN

      public static final String TEAR_DOWN
      Constant value for tear down.
      See Also:
    • EVENT_START

      public static final String EVENT_START
      Constant value for event start.
      See Also:
    • EVENT_STOP

      public static final String EVENT_STOP
      Constant value for event stop.
      See Also:
    • EVENT_FAILURE

      public static final String EVENT_FAILURE
      Constant value for event failure.
      See Also:
    • JUNIT_PLATFORM_UNIQUE_ID

      public static final String JUNIT_PLATFORM_UNIQUE_ID
      Constant value for junit platform unique id.
      See Also:
  • Constructor Details

    • AllureJunitPlatform

      public AllureJunitPlatform(io.qameta.allure.AllureLifecycle lifecycle)
      Creates an Allure junit platform with the supplied values.
      Parameters:
      lifecycle - the Allure lifecycle to use
    • AllureJunitPlatform

      public AllureJunitPlatform()
      Creates an Allure junit platform with default configuration.
  • Method Details

    • getLifecycle

      public io.qameta.allure.AllureLifecycle getLifecycle()
      Returns the lifecycle.
      Returns:
      the Allure lifecycle used by this integration
    • testPlanExecutionStarted

      public void testPlanExecutionStarted(org.junit.platform.launcher.TestPlan testPlan)
      Specified by:
      testPlanExecutionStarted in interface org.junit.platform.launcher.TestExecutionListener
    • testPlanExecutionFinished

      public void testPlanExecutionFinished(org.junit.platform.launcher.TestPlan testPlan)
      Specified by:
      testPlanExecutionFinished in interface org.junit.platform.launcher.TestExecutionListener
    • executionStarted

      public void executionStarted(org.junit.platform.launcher.TestIdentifier testIdentifier)
      Specified by:
      executionStarted in interface org.junit.platform.launcher.TestExecutionListener
    • executionFinished

      public void executionFinished(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.TestExecutionResult testExecutionResult)
      Specified by:
      executionFinished in interface org.junit.platform.launcher.TestExecutionListener
    • executionSkipped

      public void executionSkipped(org.junit.platform.launcher.TestIdentifier testIdentifier, String reason)
      Specified by:
      executionSkipped in interface org.junit.platform.launcher.TestExecutionListener
    • reportingEntryPublished

      public void reportingEntryPublished(org.junit.platform.launcher.TestIdentifier testIdentifier, org.junit.platform.engine.reporting.ReportEntry entry)
      Specified by:
      reportingEntryPublished in interface org.junit.platform.launcher.TestExecutionListener
    • getStatus

      protected io.qameta.allure.model.Status getStatus(Throwable throwable)
      Returns the status.
      Parameters:
      throwable - the throwable
      Returns:
      the status
    • getHistoryId

      protected String getHistoryId(org.junit.platform.launcher.TestIdentifier testIdentifier)
      Returns the history id.
      Parameters:
      testIdentifier - the test identifier
      Returns:
      the history id