1 package org.testng;
2 
3 import java.io.Serializable;
4 
5 /**
6  * This class represents a test class:
7  * <ul>
8  * <li> The test methods
9  * <li>The configuration methods (test and method)
10  * <li>The class file
11  * </ul>
12  *
13  * Note that the methods returned by instances of this class
14  * are expected to be correct at runtime.  In other words,
15  * they might differ from what the ITestMethodFinder returned
16  * since ITestClass will take into account the groups being
17  * included and excluded.
18  *
19  * @author <a href = "mailto:cedric&#64;beust.com">Cedric Beust</a>
20  */
21 public interface ITestClass extends IClass, Serializable {
22 
23   /**
24    * Returns all the instances the methods will be invoked upon.
25    * This will typically be an array of one object in the absence
26    * of a @Factory annotation.
27    *
28    * @param reuse flag if a new set of instances must be returned
29    *  (if set to <tt>false</tt>)
30    * @return All the instances the methods will be invoked upon.
31    *
32    * {@inheritDoc}
33    */
34   @Override
getInstances(boolean reuse)35   Object[] getInstances(boolean reuse);
36 
37   /**
38    * TODO cquezel JavaDoc.
39    *
40    * {@inheritDoc}
41    */
42   @Override
getInstanceHashCodes()43   long[] getInstanceHashCodes();
44 
45   /**
46    * @return The number of instances used in this class.  This method
47    * is needed for serialization since we don't know ahead of time if the
48    * instances of the test classes will be serializable.
49    */
50   @Override
getInstanceCount()51   int getInstanceCount();
52 
53   /**
54    * Returns all the applicable test methods.
55    * @return All the applicable test methods.
56    */
getTestMethods()57   ITestNGMethod[] getTestMethods();
58 
59   /**
60    * Returns all the methods that should be invoked
61    * before a test method is invoked.
62    * @return All the methods that should be invoked
63    * before a test method is invoked.
64    */
getBeforeTestMethods()65   ITestNGMethod[] getBeforeTestMethods();
66 
67   /**
68    * Returns all the methods that should be invoked
69    * after a test method completes.
70    * @return All the methods that should be invoked
71    * after a test method completes.
72    */
getAfterTestMethods()73   ITestNGMethod[] getAfterTestMethods();
74 
75   /**
76    * Return all the methods that should be invoked
77    * after the test class has been created and before
78    * any of its test methods is invoked.
79    * @return All the methods that should be invoked
80    * after the test class has been created and before
81    * any of its test methods is invoked.
82    */
getBeforeClassMethods()83   ITestNGMethod[] getBeforeClassMethods();
84 
85   /**
86    * Returns all the methods that should be invoked
87    * after all the tests have been run on this class.
88    * @return All the methods that should be invoked
89    * after all the tests have been run on this class.
90    */
getAfterClassMethods()91   ITestNGMethod[] getAfterClassMethods();
92 
93   /**
94    * Returns All the methods that should be invoked
95    * before the suite is run.
96    * @return All the methods that should be invoked
97    * before the suite is run.
98    */
getBeforeSuiteMethods()99   ITestNGMethod[] getBeforeSuiteMethods();
100 
101   /**
102    * Returns all the methods that should be invoked
103    * after the suite has run.
104    * @return All the methods that should be invoked
105    * after the suite has run.
106    */
getAfterSuiteMethods()107   ITestNGMethod[] getAfterSuiteMethods();
108 
109   /**
110    * Returns all &#64;Configuration methods that should be invoked before any others in the
111    * current test.
112    * @return all @Configuration methods that should be invoked before any others in the current test.
113    */
getBeforeTestConfigurationMethods()114   ITestNGMethod[] getBeforeTestConfigurationMethods();
115 
116   /**
117    * Returns all &#64;Configuration methods that should be invoked last before any others
118    * in the current test.
119    * @return all @Configuration methods that should be invoked last before any others
120    * in the current test.
121    */
getAfterTestConfigurationMethods()122   ITestNGMethod[] getAfterTestConfigurationMethods();
123 
124   /**
125    * Returns all &#64;Configuration methods that should be invoked before certain groups.
126    * @return all @Configuration methods that should be invoked before certain groups.
127    */
getBeforeGroupsMethods()128   ITestNGMethod[] getBeforeGroupsMethods();
129 
130   /**
131    * Returns all &#64;Configuration methods that should be invoked after certain groups.
132    * @return all @Configuration methods that should be invoked after certain groups.
133    */
getAfterGroupsMethods()134   ITestNGMethod[] getAfterGroupsMethods();
135 }
136