• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.junit;
2 
3 import java.lang.annotation.ElementType;
4 import java.lang.annotation.Retention;
5 import java.lang.annotation.RetentionPolicy;
6 import java.lang.annotation.Target;
7 
8 /**
9  * Sometimes you want to temporarily disable a test or a group of tests. Methods annotated with
10  * {@link org.junit.Test} that are also annotated with <code>&#064;Ignore</code> will not be executed as tests.
11  * Also, you can annotate a class containing test methods with <code>&#064;Ignore</code> and none of the containing
12  * tests will be executed. Native JUnit 4 test runners should report the number of ignored tests along with the
13  * number of tests that ran and the number of tests that failed.
14  *
15  * <p>For example:
16  * <pre>
17  *    &#064;Ignore &#064;Test public void something() { ...
18  * </pre>
19  * &#064;Ignore takes an optional default parameter if you want to record why a test is being ignored:
20  * <pre>
21  *    &#064;Ignore("not ready yet") &#064;Test public void something() { ...
22  * </pre>
23  * &#064;Ignore can also be applied to the test class:
24  * <pre>
25  *      &#064;Ignore public class IgnoreMe {
26  *          &#064;Test public void test1() { ... }
27  *          &#064;Test public void test2() { ... }
28  *         }
29  * </pre>
30  *
31  * @since 4.0
32  */
33 @Retention(RetentionPolicy.RUNTIME)
34 @Target({ElementType.METHOD, ElementType.TYPE})
35 public @interface Ignore {
36     /**
37      * The optional reason why the test is ignored.
38      */
value()39     String value() default "";
40 }
41