Source Code Cross Referenced for TestListenerAdapter.java in  » Testing » testng » org » testng » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » testng » org.testng 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.testng;
002:
003:        import java.util.ArrayList;
004:        import java.util.Collections;
005:        import java.util.List;
006:
007:        import org.testng.internal.IResultListener;
008:
009:        /**
010:         * A simple ITestListener adapter that stores all the tests
011:         * that were run.  You can retrieve these results with the
012:         * following methods:
013:         * getPassedTests()
014:         * getFailedTests()
015:         * getSkippedTests()
016:         * 
017:         * If you extend this class in order to override any of these
018:         * methods, remember to call their super equivalent if you want
019:         * this list of tests to be maintained.
020:         *
021:         * @author Cedric Beust, Aug 6, 2004
022:         * @author <a href='mailto:the_mindstorm@evolva.ro'>Alexandru Popescu</a>
023:         */
024:        public class TestListenerAdapter implements  IResultListener {
025:            private List<ITestNGMethod> m_allTestMethods = Collections
026:                    .synchronizedList(new ArrayList<ITestNGMethod>());
027:            private List<ITestResult> m_passedTests = Collections
028:                    .synchronizedList(new ArrayList<ITestResult>());
029:            private List<ITestResult> m_failedTests = Collections
030:                    .synchronizedList(new ArrayList<ITestResult>());
031:            private List<ITestResult> m_skippedTests = Collections
032:                    .synchronizedList(new ArrayList<ITestResult>());
033:            private List<ITestResult> m_failedButWSPerTests = Collections
034:                    .synchronizedList(new ArrayList<ITestResult>());
035:            private List<ITestContext> m_testContexts = Collections
036:                    .synchronizedList(new ArrayList<ITestContext>());
037:            private List<ITestResult> m_failedConfs = Collections
038:                    .synchronizedList(new ArrayList<ITestResult>());
039:            private List<ITestResult> m_skippedConfs = Collections
040:                    .synchronizedList(new ArrayList<ITestResult>());
041:            private List<ITestResult> m_passedConfs = Collections
042:                    .synchronizedList(new ArrayList<ITestResult>());
043:
044:            public void onTestSuccess(ITestResult tr) {
045:                m_allTestMethods.add(tr.getMethod());
046:                m_passedTests.add(tr);
047:            }
048:
049:            public void onTestFailure(ITestResult tr) {
050:                m_allTestMethods.add(tr.getMethod());
051:                m_failedTests.add(tr);
052:            }
053:
054:            public void onTestSkipped(ITestResult tr) {
055:                m_allTestMethods.add(tr.getMethod());
056:                m_skippedTests.add(tr);
057:            }
058:
059:            public void onTestFailedButWithinSuccessPercentage(ITestResult tr) {
060:                m_allTestMethods.add(tr.getMethod());
061:                m_failedButWSPerTests.add(tr);
062:            }
063:
064:            protected ITestNGMethod[] getAllTestMethods() {
065:                return m_allTestMethods
066:                        .toArray(new ITestNGMethod[m_allTestMethods.size()]);
067:            }
068:
069:            public void onStart(ITestContext testContext) {
070:                m_testContexts.add(testContext);
071:            }
072:
073:            public void onFinish(ITestContext testContext) {
074:            }
075:
076:            /**
077:             * @return Returns the failedButWithinSuccessPercentageTests.
078:             */
079:            public List<ITestResult> getFailedButWithinSuccessPercentageTests() {
080:                return m_failedButWSPerTests;
081:            }
082:
083:            /**
084:             * @return Returns the failedTests.
085:             */
086:            public List<ITestResult> getFailedTests() {
087:                return m_failedTests;
088:            }
089:
090:            /**
091:             * @return Returns the passedTests.
092:             */
093:            public List<ITestResult> getPassedTests() {
094:                return m_passedTests;
095:            }
096:
097:            /**
098:             * @return Returns the skippedTests.
099:             */
100:            public List<ITestResult> getSkippedTests() {
101:                return m_skippedTests;
102:            }
103:
104:            private static void ppp(String s) {
105:                System.out.println("[TestListenerAdapter] " + s);
106:            }
107:
108:            /**
109:             * @param allTestMethods The allTestMethods to set.
110:             */
111:            public void setAllTestMethods(List<ITestNGMethod> allTestMethods) {
112:                m_allTestMethods = allTestMethods;
113:            }
114:
115:            /**
116:             * @param failedButWithinSuccessPercentageTests The failedButWithinSuccessPercentageTests to set.
117:             */
118:            public void setFailedButWithinSuccessPercentageTests(
119:                    List<ITestResult> failedButWithinSuccessPercentageTests) {
120:                m_failedButWSPerTests = failedButWithinSuccessPercentageTests;
121:            }
122:
123:            /**
124:             * @param failedTests The failedTests to set.
125:             */
126:            public void setFailedTests(List<ITestResult> failedTests) {
127:                m_failedTests = failedTests;
128:            }
129:
130:            /**
131:             * @param passedTests The passedTests to set.
132:             */
133:            public void setPassedTests(List<ITestResult> passedTests) {
134:                m_passedTests = passedTests;
135:            }
136:
137:            /**
138:             * @param skippedTests The skippedTests to set.
139:             */
140:            public void setSkippedTests(List<ITestResult> skippedTests) {
141:                m_skippedTests = skippedTests;
142:            }
143:
144:            public void onTestStart(ITestResult result) {
145:            }
146:
147:            /**
148:             * @return
149:             */
150:            public List<ITestContext> getTestContexts() {
151:                return m_testContexts;
152:            }
153:
154:            public List<ITestResult> getConfigurationFailures() {
155:                return m_failedConfs;
156:            }
157:
158:            /**
159:             * @see org.testng.internal.IConfigurationListener#onConfigurationFailure(org.testng.ITestResult)
160:             */
161:            public void onConfigurationFailure(ITestResult itr) {
162:                m_failedConfs.add(itr);
163:            }
164:
165:            public List<ITestResult> getConfigurationSkips() {
166:                return m_skippedConfs;
167:            }
168:
169:            /**
170:             * @see org.testng.internal.IConfigurationListener#onConfigurationSkip(org.testng.ITestResult)
171:             */
172:            public void onConfigurationSkip(ITestResult itr) {
173:                m_skippedConfs.add(itr);
174:            }
175:
176:            /**
177:             * @see org.testng.internal.IConfigurationListener#onConfigurationSuccess(org.testng.ITestResult)
178:             */
179:            public void onConfigurationSuccess(ITestResult itr) {
180:                m_passedConfs.add(itr);
181:            }
182:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.