Package spock.lang

Annotation Type PendingFeatureIf


@Beta
@Retention(RUNTIME)
@Target(METHOD)
@Repeatable(Container.class)
public @interface PendingFeatureIf
Marks the annotated feature or selected iterations as PendingFeature if the given condition holds. Otherwise it will be treated like a normal feature or iteration.

The configured closure is called with a delegate of type PreconditionContext which provides access to system properties, environment variables, the type of operating system and JVM.

If applied to a data driven feature, the closure can also access the data variables. If the closure does not reference any actual data variables, the whole feature is deemed pending and only if all iterations become successful will be marked as failing. But if the closure actually does reference valid data variables, the individual iterations where the condition holds are deemed pending and each will individually fail as soon as it would be successful without this annotation.

See Also:
PreconditionContext
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static interface  PendingFeatureIf.Container  
  • Required Element Summary

    Required Elements
    Modifier and Type Required Element Description
    Class<? extends Closure> value
    If this condition holds true, the feature will be considered "Pending" and will behave the same way as if it were annotated as a PendingFeature
  • Optional Element Summary

    Optional Elements
    Modifier and Type Optional Element Description
    Class<? extends Throwable>[] exceptions
    Configures which types of Exceptions are expected in the pending feature.
    String reason
    The reason why this feature is pending
  • Element Details

    • value

      Class<? extends Closure> value
      If this condition holds true, the feature will be considered "Pending" and will behave the same way as if it were annotated as a PendingFeature

      If the condition is false, it will not be treated as pending

      Returns:
      Closure to be evaluated
    • exceptions

      Class<? extends Throwable>[] exceptions
      Configures which types of Exceptions are expected in the pending feature.

      Subclasses are included if their parent class is listed.

      Returns:
      array of Exception classes to ignore.
      Default:
      {java.lang.Exception.class}
    • reason

      String reason
      The reason why this feature is pending
      Returns:
      reason why this feature is pending
      Default:
      ""