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 Summary
Modifier and TypeMethodDescriptiondefault TestFeatureLogCollectionbuildFeatureLogCollection(org.aopalliance.intercept.MethodInvocation methodInvocation, Object instance) Get or build the feature log collection object that should be used for the intercepted method.buildScenarioDescription(String featureName, String scenarioName) Build the description of the scenario for the log file.default TestScenarioLogCollectionbuildScenarioLogCollection(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.buildScenarioName(String featureName, String scenarioId) Build the name of the scenario for the log file.buildStepExecutionInfoEntity(org.aopalliance.intercept.MethodInvocation methodInvocation) Build an entity that contains information about the executed method.default ObjectexecuteStepMethod(org.aopalliance.intercept.MethodInvocation methodInvocation, TestScenarioLogCollection scenarioLogCollection) Execute the original method that was intercepted by this interceptor.getAnnotation(org.aopalliance.intercept.MethodInvocation methodInvocation) Get the TestNG Annotation of the intercepted method.default voidhandleStepExecutionFailure(TestScenarioLogCollection scenarioLogCollection) Deal with a failure of the execution of the intercepted method.default voidupdateTestContextWithLogCollection(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.
-
Method Details
-
buildStepExecutionInfoEntity
Build an entity that contains information about the executed method.- Parameters:
methodInvocation- The method that was intercepted- Returns:
- Step execution information entity
-
getAnnotation
Get the TestNG Annotation of the intercepted method.- Parameters:
methodInvocation- The method that was intercepted- Returns:
- The TestNG annotation of the method
-
buildScenarioName
Build the name of the scenario for the log file.- Parameters:
featureName- Name of the feature the scenario belongs toscenarioId- ID of the scenario- Returns:
- Name of the scenario
-
buildScenarioDescription
Build the description of the scenario for the log file.- Parameters:
featureName- Name of the featurescenarioName- 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 interceptedinstance- 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 tomethodInvocation- The method that was interceptedinstance- 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 methodscenarioLogCollection- 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 interceptedscenarioLogCollection- 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
Deal with a failure of the execution of the intercepted method.- Parameters:
scenarioLogCollection- The scenario log collection object for the method that was intercepted
-