1 package org.testng;
2 
3 import com.google.inject.Injector;
4 import com.google.inject.Module;
5 
6 import org.testng.internal.ClassImpl;
7 import org.testng.xml.XmlTest;
8 
9 import java.util.Collection;
10 import java.util.Date;
11 import java.util.List;
12 
13 
14 /**
15  * This class defines a test context which contains all the information
16  * for a given test run.  An instance of this context is passed to the
17  * test listeners so they can query information about their
18  * environment.
19  *
20  * @author Cedric Beust, Aug 6, 2004
21  * @author <a href='mailto:the_mindstorm@evolva.ro'>Alexandru Popescu</a>
22  */
23 public interface ITestContext extends IAttributes {
24 
25   /**
26    * The name of this test.
27    */
getName()28   public String getName();
29 
30   /**
31    * When this test started running.
32    */
getStartDate()33   public Date getStartDate();
34 
35   /**
36    * When this test stopped running.
37    */
getEndDate()38   public Date getEndDate();
39 
40   /**
41    * @return A list of all the tests that run successfully.
42    */
getPassedTests()43   public IResultMap getPassedTests();
44 
45   /**
46    * @return A list of all the tests that were skipped
47    */
getSkippedTests()48   public IResultMap  getSkippedTests();
49 
50   /**
51    * @return A list of all the tests that failed but are being ignored because
52    * annotated with a successPercentage.
53    */
getFailedButWithinSuccessPercentageTests()54   public IResultMap  getFailedButWithinSuccessPercentageTests();
55 
56   /**
57    * @return A map of all the tests that passed, indexed by
58    * their ITextMethor.
59    *
60    * @see org.testng.ITestNGMethod
61    */
getFailedTests()62   public IResultMap getFailedTests();
63 
64   /**
65    * @return All the groups that are included for this test run.
66    */
getIncludedGroups()67   public String[] getIncludedGroups();
68 
69   /**
70    * @return All the groups that are excluded for this test run.
71    */
getExcludedGroups()72   public String[] getExcludedGroups();
73 
74   /**
75    * @return Where the reports will be generated.
76    */
getOutputDirectory()77   public String getOutputDirectory();
78 
79   /**
80    * @return The Suite object that was passed to the runner
81    * at start-up.
82    */
getSuite()83   public ISuite getSuite();
84 
85   /**
86    * @return All the test methods that were run.
87    */
getAllTestMethods()88   public ITestNGMethod[] getAllTestMethods();
89 
90   /**
91    * @return The host where this test was run, or null if it was run locally.  The
92    * returned string has the form:  host:port
93    */
getHost()94   public String getHost();
95 
96   /**
97    * @return All the methods that were not included in this test run.
98    */
getExcludedMethods()99   public Collection<ITestNGMethod> getExcludedMethods();
100 
101   /**
102    * Retrieves information about the successful configuration method invocations.
103    */
getPassedConfigurations()104   public IResultMap getPassedConfigurations();
105 
106   /**
107    * Retrieves information about the skipped configuration method invocations.
108    */
getSkippedConfigurations()109   public IResultMap getSkippedConfigurations();
110 
111   /**
112    * Retrieves information about the failed configuration method invocations.
113    */
getFailedConfigurations()114   public IResultMap getFailedConfigurations();
115 
116   /**
117    * @return the current XmlTest.
118    */
getCurrentXmlTest()119   public XmlTest getCurrentXmlTest();
120 
getGuiceModules(Class<? extends Module> cls)121   public List<Module> getGuiceModules(Class<? extends Module> cls);
122 
getInjector(List<Module> moduleInstances)123   public Injector getInjector(List<Module> moduleInstances);
getInjector(IClass iClass)124   Injector getInjector(IClass iClass);
addInjector(List<Module> moduleInstances, Injector injector)125   public void addInjector(List<Module> moduleInstances, Injector injector);
126 }
127