Interface AbstractTestNGAnnotatedMethodInterceptor<T extends AbstractStepExecutionInfo>

Type Parameters:
T - the test execution entity type
All Known Implementing Classes:
QtafTestNGAfterMethodInterceptor, QtafTestNGAfterSuiteInterceptor, QtafTestNGAfterTestInterceptor, QtafTestNGAnnotatedMethodInterceptor, QtafTestNGBeforeMethodInterceptor, QtafTestNGBeforeSuiteInterceptor, QtafTestNGBeforeTestInterceptor

public interface AbstractTestNGAnnotatedMethodInterceptor<T extends AbstractStepExecutionInfo>
This class serves as a base class for all interceptor classes that intercept methods annotated with TestNG annotations that deal with the test flow like @BeforeTest and @AfterTest.
  • Method Details

    • buildStepExecutionInfoEntity

      T buildStepExecutionInfoEntity(org.aopalliance.intercept.MethodInvocation methodInvocation)
      Build an entity that contains information about the executed method.
      Parameters:
      methodInvocation - The method that was intercepted
      Returns:
      Step execution information entity
    • getAnnotation

      Annotation getAnnotation(org.aopalliance.intercept.MethodInvocation methodInvocation)
      Get the TestNG Annotation of the intercepted method.
      Parameters:
      methodInvocation - The method that was intercepted
      Returns:
      The TestNG annotation of the method
    • buildScenarioName

      String buildScenarioName(String featureName, String scenarioId)
      Build the name of the scenario for the log file.
      Parameters:
      featureName - Name of the feature the scenario belongs to
      scenarioId - ID of the scenario
      Returns:
      Name of the scenario
    • buildScenarioDescription

      String buildScenarioDescription(String featureName, String scenarioName)
      Build the description of the scenario for the log file.
      Parameters:
      featureName - Name of the feature
      scenarioName - Name of the scenario
      Returns:
      Description of the scenario
    • buildFeatureLogCollection

      default TestFeatureLogCollection buildFeatureLogCollection(org.aopalliance.intercept.MethodInvocation methodInvocation, Object instance)
      Get or build the feature log collection object that should be used for the intercepted method.
      Parameters:
      methodInvocation - The method that was intercepted
      instance - The object that called the method
      Returns:
      Feature log collection object
    • buildScenarioLogCollection

      default TestScenarioLogCollection buildScenarioLogCollection(TestFeatureLogCollection featureLogCollection, org.aopalliance.intercept.MethodInvocation methodInvocation, Object instance)
      Get or build the scenario log collection object that should be used for the intercepted method.
      Parameters:
      featureLogCollection - The feature log collection object the scenario log collection object belongs to
      methodInvocation - The method that was intercepted
      instance - The object that called the method
      Returns:
      Scenario log collection object
    • updateTestContextWithLogCollection

      default void updateTestContextWithLogCollection(IQtafTestContext instance, TestScenarioLogCollection scenarioLogCollection)
      Add the scenario log collection to the TestContext object the method call came from and all its nested TestContext objects like page objects.
      Parameters:
      instance - The object that called the method
      scenarioLogCollection - The scenario log collection object
    • executeStepMethod

      default Object executeStepMethod(org.aopalliance.intercept.MethodInvocation methodInvocation, TestScenarioLogCollection scenarioLogCollection) throws Throwable
      Execute the original method that was intercepted by this interceptor.
      Parameters:
      methodInvocation - The method that was intercepted
      scenarioLogCollection - The scenario log collection object for the current method
      Returns:
      The result of the intercepted method
      Throws:
      Throwable - Exception that was thrown by the intercepted method
    • handleStepExecutionFailure

      default void handleStepExecutionFailure(TestScenarioLogCollection scenarioLogCollection)
      Deal with a failure of the execution of the intercepted method.
      Parameters:
      scenarioLogCollection - The scenario log collection object for the method that was intercepted