• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.testng;
2 
3 import org.testng.collections.Objects;
4 import org.testng.xml.XmlSuite;
5 
6 /**
7  * This class logs the result of an entire Test Suite (defined by a
8  * property file).
9  *
10  * @author Cedric Beust, May 10, 2004
11  *
12  */
13 class SuiteResult implements ISuiteResult, Comparable {
14 	/* generated */
15 	private static final long serialVersionUID = 6778513869858860756L;
16   //FIXME: Is m_propertyFileName needed?
17 	private String m_propertyFileName =  null;
18   private XmlSuite m_suite = null;
19   private ITestContext m_testContext = null;
20 
SuiteResult(XmlSuite suite, ITestContext tr)21   protected SuiteResult(XmlSuite suite, ITestContext tr) {
22     m_suite = suite;
23     m_testContext = tr;
24   }
25 
26   /**
27    * @return Returns the propertyFileName.
28    */
29   @Override
getPropertyFileName()30   public String getPropertyFileName() {
31     return m_propertyFileName;
32   }
33 
34   /**
35    * @return Returns the singleTestRunner.
36    */
37   @Override
getTestContext()38   public ITestContext getTestContext() {
39     return m_testContext;
40   }
41   /**
42    * @return Returns the suite.
43    */
getSuite()44   public XmlSuite getSuite() {
45     return m_suite;
46   }
47 
48   @Override
compareTo(Object o)49   public int compareTo(Object o) {
50     int result = 0;
51     try {
52       SuiteResult other = (SuiteResult) o;
53       String n1 = getTestContext().getName();
54       String n2 = other.getTestContext().getName();
55       result = n1.compareTo(n2);
56     }
57     catch(Exception ex) {
58       ex.printStackTrace();
59     }
60 
61     return result;
62   }
63 
64   /**
65    * Returns the test context name.
66    * {@inheritDoc}
67    */
68   @Override
toString()69   public String toString() {
70     return Objects.toStringHelper(getClass())
71         .add("context", getTestContext().getName())
72         .toString();
73   }
74 
75 }
76