Package org.testng

Interface IAnnotationTransformer

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default void transform​(IConfigurationAnnotation annotation, java.lang.Class testClass, java.lang.reflect.Constructor testConstructor, java.lang.reflect.Method testMethod)
      Transform an IConfiguration annotation.
      default void transform​(IDataProviderAnnotation annotation, java.lang.reflect.Method method)
      Transform an IDataProvider annotation.
      default void transform​(IFactoryAnnotation annotation, java.lang.reflect.Method method)
      Transform an IFactory annotation.
      default void transform​(IListenersAnnotation annotation, java.lang.Class<?> testClass)  
      default void transform​(ITestAnnotation annotation, java.lang.Class testClass, java.lang.reflect.Constructor testConstructor, java.lang.reflect.Method testMethod)
      This method will be invoked by TestNG to give you a chance to modify a TestNG annotation read from your test classes.
    • Method Detail

      • transform

        default void transform​(ITestAnnotation annotation,
                               java.lang.Class testClass,
                               java.lang.reflect.Constructor testConstructor,
                               java.lang.reflect.Method testMethod)
        This method will be invoked by TestNG to give you a chance to modify a TestNG annotation read from your test classes. You can change the values you need by calling any of the setters on the ITest interface.

        Note that only one of the three parameters testClass, testConstructor and testMethod will be non-null.

        Parameters:
        annotation - The annotation that was read from your test class.
        testClass - If the annotation was found on a class, this parameter represents this class (null otherwise).
        testConstructor - If the annotation was found on a constructor, this parameter represents this constructor (null otherwise).
        testMethod - If the annotation was found on a method, this parameter represents this method (null otherwise).
      • transform

        default void transform​(IConfigurationAnnotation annotation,
                               java.lang.Class testClass,
                               java.lang.reflect.Constructor testConstructor,
                               java.lang.reflect.Method testMethod)
        Transform an IConfiguration annotation.

        Note that only one of the three parameters testClass, testConstructor and testMethod will be non-null.

        Parameters:
        annotation - The annotation that was read from your test class.
        testClass - If the annotation was found on a class, this parameter represents this class (null otherwise).
        testConstructor - If the annotation was found on a constructor, this parameter represents this constructor (null otherwise).
        testMethod - If the annotation was found on a method, this parameter represents this method (null otherwise).
      • transform

        default void transform​(IDataProviderAnnotation annotation,
                               java.lang.reflect.Method method)
        Transform an IDataProvider annotation.
        Parameters:
        annotation - The @DataProvider annotation
        method - The method annotated with the IDataProvider annotation.
      • transform

        default void transform​(IFactoryAnnotation annotation,
                               java.lang.reflect.Method method)
        Transform an IFactory annotation.
        Parameters:
        annotation - The annotation factory
        method - The method annotated with the IFactory annotation.
      • transform

        default void transform​(IListenersAnnotation annotation,
                               java.lang.Class<?> testClass)