• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.testng.annotations;
2 
3 import java.lang.annotation.Retention;
4 import java.lang.annotation.Target;
5 
6 @Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
7 @Target(java.lang.annotation.ElementType.METHOD)
8 public @interface BeforeGroups {
9   /**
10    * The list of groups that this configuration method will run before. If specified it overrides the
11    * list of groups provided through {@link #groups()} attribute.
12    * This method is guaranteed to run shortly before the first test method that
13    * belongs to any of these groups is invoked.
14    */
value()15   public String[] value() default {};
16 
17   /**
18    * Whether methods on this class/method are enabled.
19    */
enabled()20   public boolean enabled() default true;
21 
22   /**
23    * The list of groups this class/method belongs to. This list also describes the groups
24    * that this configuration method will run before (if no {@link #value()} attribute is defined).
25    */
groups()26   public String[] groups() default {};
27 
28   /**
29    * The list of groups this method depends on.  Every method
30    * member of one of these groups is guaranteed to have been
31    * invoked before this method.  Furthermore, if any of these
32    * methods was not a SUCCESS, this test method will not be
33    * run and will be flagged as a SKIP.
34    */
dependsOnGroups()35   public String[] dependsOnGroups() default {};
36 
37   /**
38    * The list of methods this method depends on.  There is no guarantee
39    * on the order on which the methods depended upon will be run, but you
40    * are guaranteed that all these methods will be run before the test method
41    * that contains this annotation is run.  Furthermore, if any of these
42    * methods was not a SUCCESS, this test method will not be
43    * run and will be flagged as a SKIP.
44    *
45    *  If some of these methods have been overloaded, all the overloaded
46    *  versions will be run.
47    */
dependsOnMethods()48   public String[] dependsOnMethods() default {};
49 
50   /**
51    *  For before methods (beforeSuite, beforeTest, beforeTestClass and
52    *  beforeTestMethod, but not beforeGroups):
53    *  If set to true, this configuration method will be run
54    *  regardless of what groups it belongs to.
55    *  <br>
56    * For after methods (afterSuite, afterClass, ...):
57    *  If set to true, this configuration method will be run
58    *  even if one or more methods invoked previously failed or
59    *  was skipped.
60    */
alwaysRun()61   public boolean alwaysRun() default false;
62 
63   /**
64    * If true, this &#64;Configuration method will belong to groups specified in the
65    * &#64;Test annotation on the class (if any).
66    */
inheritGroups()67   public boolean inheritGroups() default true;
68 
69   /**
70    * The description for this method.  The string used will appear in the
71    * HTML report and also on standard output if verbose >= 2.
72    */
description()73   public String description() default "";
74 
75   /**
76    * The maximum number of milliseconds this method should take.
77    * If it hasn't returned after this time, this method will fail and
78    * it will cause test methods depending on it to be skipped.
79    */
timeOut()80   public long timeOut() default 0;
81 }
82