All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spock.lang.PendingFeatureIf Maven / Gradle / Ivy

Go to download

Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most IDEs, build tools, and continuous integration servers. Spock is inspired from JUnit, jMock, RSpec, Groovy, Scala, Vulcans, and other fascinating life forms.

There is a newer version: 2.4-M4-groovy-4.0
Show newest version
package spock.lang;

import groovy.lang.Closure;
import org.spockframework.runtime.extension.ExtensionAnnotation;
import org.spockframework.runtime.extension.builtin.PendingFeatureIfExtension;
import org.spockframework.runtime.extension.builtin.PreconditionContext;
import org.spockframework.util.Beta;

import java.lang.annotation.*;

/**
 * Marks the annotated feature or selected iterations as {@link 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 {@link 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 PreconditionContext */ @Beta @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) @ExtensionAnnotation(PendingFeatureIfExtension.class) @Repeatable(PendingFeatureIf.Container.class) public @interface PendingFeatureIf { /** * If this condition holds true, the feature will be considered "Pending" * and will behave the same way as if it were annotated as a {@link PendingFeature} * *

If the condition is false, it will not be treated as pending * * @return Closure to be evaluated */ Class value(); /** * Configures which types of Exceptions are expected in the pending feature. * *

Subclasses are included if their parent class is listed. * * @return array of Exception classes to ignore. */ Class[] exceptions() default {Exception.class}; /** * The reason why this feature is pending * * @return the string to use for the skip message */ String reason() default ""; /** * @since 2.0 */ @Beta @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) @interface Container { PendingFeatureIf[] value(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy