001: package org.testng;
002:
003: import java.io.Serializable;
004: import java.util.Collection;
005: import java.util.Date;
006:
007: /**
008: * This class defines a test context which contains all the information
009: * for a given test run. An instance of this context is passed to the
010: * test listeners so they can query information about their
011: * environment.
012: *
013: * @author Cedric Beust, Aug 6, 2004
014: * @author <a href='mailto:the_mindstorm@evolva.ro'>Alexandru Popescu</a>
015: */
016: public interface ITestContext extends Serializable {
017:
018: /**
019: * The name of this test.
020: */
021: public String getName();
022:
023: /**
024: * Return a context attribute
025: * @param name The name of the attribute to return
026: */
027: public Object getAttribute(String name);
028:
029: /**
030: * Set a custom attribute in the current context
031: */
032: public void setAttribute(String name, Object value);
033:
034: /**
035: * When this test started running.
036: */
037: public Date getStartDate();
038:
039: /**
040: * When this test stopped running.
041: */
042: public Date getEndDate();
043:
044: /**
045: * @return A list of all the tests that run successfully.
046: */
047: public IResultMap getPassedTests();
048:
049: /**
050: * @return A list of all the tests that were skipped
051: */
052: public IResultMap getSkippedTests();
053:
054: /**
055: * @return A list of all the tests that failed but are being ignored because
056: * annotated with a successPercentage.
057: */
058: public IResultMap getFailedButWithinSuccessPercentageTests();
059:
060: /**
061: * @return A map of all the tests that passed, indexed by
062: * their ITextMethor.
063: *
064: * @see org.testng.ITestNGMethod
065: */
066: public IResultMap getFailedTests();
067:
068: /**
069: * @return All the groups that are included for this test run.
070: */
071: public String[] getIncludedGroups();
072:
073: /**
074: * @return All the groups that are excluded for this test run.
075: */
076: public String[] getExcludedGroups();
077:
078: /**
079: * @return Where the reports will be generated.
080: */
081: public String getOutputDirectory();
082:
083: /**
084: * @return The Suite object that was passed to the runner
085: * at start-up.
086: */
087: public ISuite getSuite();
088:
089: /**
090: * @return All the test methods that were run.
091: */
092: public ITestNGMethod[] getAllTestMethods();
093:
094: /**
095: * @return The host where this test was run, or null if it was run locally. The
096: * returned string has the form: host:port
097: */
098: public String getHost();
099:
100: /**
101: * @return All the methods that were not included in this test run.
102: */
103: public Collection<ITestNGMethod> getExcludedMethods();
104:
105: /**
106: * Retrieves information about the successful configuration method invocations.
107: * @return
108: */
109: public IResultMap getPassedConfigurations();
110:
111: /**
112: * Retrieves information about the skipped configuration method invocations.
113: * @return
114: */
115: public IResultMap getSkippedConfigurations();
116:
117: /**
118: * Retrieves information about the failed configuration method invocations.
119: * @return
120: */
121: public IResultMap getFailedConfigurations();
122: }
|