Annotation Type IteratedParameter


  • @Retention(RUNTIME)
    @Target({FIELD,PARAMETER})
    public @interface IteratedParameter
    Fields or step parameters can be annotated with IteratedParameter. Parameters are injected by tapir at Test execution runtime. There are several ways how to provide the data:
    1. unparameterized @Parameter: You have to implement a method which's name is derived from the field / parameter name in the test class which returns an Iterable of the parameter
    2. value() or method(): You have to implement a method with the given name in the test class which returns an Iterable of the parameter
    3. providerClass(): The given providerClass has to provide a method which returns the parameter. The method name can be derived from the field / parameter name or explicitly specified by using value()/method().
    For every element in the returned Iterable the test class or step is executed. As you can annotate as many fields and step parameters as you like tapir executes them by using the cartesian product. Example:
    
     
     @TestClass
     class MyTest {
       @IteratedParameter String stringParameter
       @IteratedParameter Integer integerParameter
     
       @Step def step1(@IteratedParameter String stepStringParameter, @IteratedParameter Integer stepIntegerParameter) {
       }
     
       override stringParameterParameter() {
         #["a", "b"]
       }
     
       override integerParameterParameter() {
         #[1, 2]
       }
     
       override step1StepStringParameterParameter() {
         #["y", "z"]
       }
     
       override step1StepIntegerParameterParameter() {
         #[8, 9]
       }
     }
      
    step1 will be executed 16 times:
    stringParameter integerParameter stepStringParameter stepIntegerParameter
    a1y8
    a1y9
    a1z8
    a1z9
    a2y8
    a2y9
    a2z8
    a2z9
    b1y8
    b1y9
    b1z8
    b1z9
    b2y8
    b2y9
    b2z8
    b2z9
    If a test class or step should not be executed multiple times based on the parameter value, please consult Parameter.
    Since:
    2.0.0
    Author:
    Nils Christian Ehmke <[email protected]>, Oliver Libutzki <[email protected]>
    See Also:
    Parameter
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String method
      An alias for value().
      java.lang.Class<?> providerClass
      The name of the class which includes the method defined as value() or method().
      java.lang.String value
      The name of the method which provides the parameters.
    • Element Detail

      • value

        java.lang.String value
        The name of the method which provides the parameters.
        Returns:
        the name of the method which provides the parameters
        Since:
        2.0.0
        Default:
        ""
      • method

        java.lang.String method
        An alias for value(). If both attributes are set, value() is preferred.
        Returns:
        the name of the method which provides the parameters
        Since:
        2.0.0
        Default:
        ""
      • providerClass

        java.lang.Class<?> providerClass
        The name of the class which includes the method defined as value() or method(). If the annotated method is located in the same class this parameter can be omitted.
        Returns:
        the provider class
        Since:
        2.0.0
        Default:
        java.lang.Void.class