001: package org.depunit.annotations;
002:
003: import static java.lang.annotation.ElementType.CONSTRUCTOR;
004: import static java.lang.annotation.ElementType.METHOD;
005: import static java.lang.annotation.ElementType.TYPE;
006:
007: import java.lang.annotation.Retention;
008: import java.lang.annotation.Target;
009:
010: /**
011: * Mark a class or a method as part of the test.
012: *
013: * @author Cedric Beust, Apr 26, 2004
014: */
015: @Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
016: @Target({METHOD,TYPE,CONSTRUCTOR})
017: public @interface Test {
018: public String[] hardDependencyOn() default {};
019:
020: public String[] softDependencyOn() default {};
021:
022: public String cleanupMethod() default "";
023:
024: /**
025: * The list of groups this class/method belongs to.
026: */
027: public String[] groups() default {};
028:
029: /**
030: * Whether methods on this class/method are enabled.
031: */
032: public boolean enabled() default true;
033:
034: /**
035: * The list of groups this method depends on. Every method
036: * member of one of these groups is guaranteed to have been
037: * invoked before this method. Furthermore, if any of these
038: * methods was not a SUCCESS, this test method will not be
039: * run and will be flagged as a SKIP.
040: */
041: public String[] dependsOnGroups() default {};
042:
043: /**
044: * The list of methods this method depends on. There is no guarantee
045: * on the order on which the methods depended upon will be run, but you
046: * are guaranteed that all these methods will be run before the test method
047: * that contains this annotation is run. Furthermore, if any of these
048: * methods was not a SUCCESS, this test method will not be
049: * run and will be flagged as a SKIP.
050: *
051: * If some of these methods have been overloaded, all the overloaded
052: * versions will be run.
053: */
054: public String[] dependsOnMethods() default {};
055:
056: /**
057: * The maximum number of milliseconds this test should take.
058: * If it hasn't returned after this time, it will be marked as a FAIL.
059: */
060: public long timeOut() default 0;
061:
062: /**
063: * The number of times this method should be invoked.
064: */
065: public int invocationCount() default 1;
066:
067: /**
068: * The size of the thread pool for this method. The method will be invoked
069: * from multiple threads as specified by invocationCount.
070: * Note: this attribute is ignored if invocationCount is not specified
071: */
072: public int threadPoolSize() default 0;
073:
074: /**
075: * The percentage of success expected from this method.
076: */
077: public int successPercentage() default 100;
078:
079: /**
080: * The name of the data provider for this test method.
081: * @see org.testng.annotations.DataProvider
082: */
083: public String dataProvider() default "";
084:
085: /**
086: * The class where to look for the data provider. If not
087: * specified, the dataprovider will be looked on the class
088: * of the current test method or one of its super classes.
089: * If this attribute is specified, the data provider method
090: * needs to be static on the specified class.
091: */
092: public Class dataProviderClass() default Object.class;
093:
094: /**
095: * If set to true, this test method will always be run even if it depends
096: * on a method that failed. This attribute will be ignored if this test
097: * doesn't depend on any method or group.
098: */
099: public boolean alwaysRun() default false;
100:
101: /**
102: * The description for this method. The string used will appear in the
103: * HTML report and also on standard output if verbose >= 2.
104: */
105: public String description() default "";
106:
107: /**
108: * The list of exceptions that a test method is expected to throw. If no
109: * exception or a different than one on this list is thrown, this test will be
110: * marked a failure.
111: */
112: public Class[] expectedExceptions() default {};
113:
114: /**
115: * The name of the suite this test class should be placed in. This
116: * attribute is ignore if @Test is not at the class level.
117: */
118: public String suiteName() default "";
119:
120: /**
121: * The name of the test this test class should be placed in. This
122: * attribute is ignore if @Test is not at the class level.
123: */
124: public String testName() default "";
125:
126: /**
127: * If set to true, all the methods on this test class are guaranteed to run
128: * sequentially, even if the tests are currently being run with parallel="true".
129: *
130: * This attribute can only be used at the class level and will be ignored
131: * if used at the method level.
132: */
133: public boolean sequential() default false;
134:
135: }
|