Home | History | Annotate | Download | only in testng
      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    */
     27   public int getStatus();
     28   public void setStatus(int status);
     29 
     30   /**
     31    * @return The test method this result represents.
     32    */
     33   public ITestNGMethod getMethod();
     34 
     35   /**
     36    * @return The parameters this method was invoked with.
     37    */
     38   public Object[] getParameters();
     39   public void setParameters(Object[] parameters);
     40 
     41   /**
     42    * @return The test class used this object is a result for.
     43    */
     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    */
     50   public Throwable getThrowable();
     51   public void setThrowable(Throwable throwable);
     52 
     53   /**
     54    * @return the start date for this test, in milliseconds.
     55    */
     56   public long getStartMillis();
     57 
     58   /**
     59    * @return the end date for this test, in milliseconds.
     60    */
     61   public long getEndMillis();
     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    */
     68   public String getName();
     69 
     70   /**
     71    * @return true if if this test run is a SUCCESS
     72    */
     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    */
     79   public String getHost();
     80 
     81   /**
     82    * The instance on which this method was run.
     83    */
     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    */
     89   public String getTestName();
     90 
     91   public String getInstanceName();
     92 
     93   /**
     94    * @return the {@link ITestContext} for this test result.
     95    */
     96   public ITestContext getTestContext();
     97 }
     98