• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.testng;
2 
3 
4 /**
5  * This class describes the result of a test.
6  *
7  * @author Cedric Beust, May 2, 2004
8  * @since May 2, 2004
9  * @version $Revision: 721 $, $Date: 2009-05-23 09:55:46 -0700 (Sat, 23 May 2009) $
10  *
11  */
12 public interface ITestResult extends IAttributes, Comparable<ITestResult> {
13 
14   //
15   // Test status
16   //
17   public static final int SUCCESS = 1;
18   public static final int FAILURE = 2;
19   public static final int SKIP = 3;
20   public static final int SUCCESS_PERCENTAGE_FAILURE = 4;
21   public static final int STARTED= 16;
22 
23   /**
24    * @return The status of this result, using one of the constants
25    * above.
26    */
getStatus()27   public int getStatus();
setStatus(int status)28   public void setStatus(int status);
29 
30   /**
31    * @return The test method this result represents.
32    */
getMethod()33   public ITestNGMethod getMethod();
34 
35   /**
36    * @return The parameters this method was invoked with.
37    */
getParameters()38   public Object[] getParameters();
setParameters(Object[] parameters)39   public void setParameters(Object[] parameters);
40 
41   /**
42    * @return The test class used this object is a result for.
43    */
getTestClass()44   public IClass getTestClass();
45 
46   /**
47    * @return The throwable that was thrown while running the
48    * method, or null if no exception was thrown.
49    */
getThrowable()50   public Throwable getThrowable();
setThrowable(Throwable throwable)51   public void setThrowable(Throwable throwable);
52 
53   /**
54    * @return the start date for this test, in milliseconds.
55    */
getStartMillis()56   public long getStartMillis();
57 
58   /**
59    * @return the end date for this test, in milliseconds.
60    */
getEndMillis()61   public long getEndMillis();
setEndMillis(long millis)62   public void setEndMillis(long millis);
63 
64   /**
65    * @return The name of this TestResult, typically identical to the name
66    * of the method.
67    */
getName()68   public String getName();
69 
70   /**
71    * @return true if if this test run is a SUCCESS
72    */
isSuccess()73   public boolean isSuccess();
74 
75   /**
76    * @return The host where this suite was run, or null if it was run locally.  The
77    * returned string has the form:  host:port
78    */
getHost()79   public String getHost();
80 
81   /**
82    * The instance on which this method was run.
83    */
getInstance()84   public Object getInstance();
85 
86   /**
87    * If this result's related instance implements ITest or use @Test(testName=...), returns its test name, otherwise returns null.
88    */
getTestName()89   public String getTestName();
90 
getInstanceName()91   public String getInstanceName();
92 
93   /**
94    * @return the {@link ITestContext} for this test result.
95    */
getTestContext()96   public ITestContext getTestContext();
97 }
98