Source Code Cross Referenced for RunListener.java in  » Testing » junit » org » junit » runner » notification » 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 » junit » org.junit.runner.notification 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package org.junit.runner.notification;
02:
03:        import org.junit.runner.Description;
04:        import org.junit.runner.Result;
05:
06:        /**
07:         * <p>If you need to respond to the events during a test run, extend <code>RunListener</code>
08:         * and override the appropriate methods. If a listener throws an exception while processing a 
09:         * test event, it will be removed for the remainder of the test run.</p>
10:         * 
11:         * <p>For example, suppose you have a <code>Cowbell</code>
12:         * class that you want to make a noise whenever a test fails. You could write:
13:         * <pre>
14:         * public class RingingListener extends RunListener {
15:         *    public void testFailure(Failure failure) {
16:         *       Cowbell.ring();
17:         *    }
18:         * }
19:         * </pre>
20:         * </p>
21:         * 
22:         * <p>To invoke your listener, you need to run your tests through <code>JUnitCore</code>.
23:         * <pre>
24:         * public void main(String... args) {
25:         *    JUnitCore core= new JUnitCore();
26:         *    core.addListener(new RingingListener());
27:         *    core.run(MyTestClass.class);
28:         * }
29:         * </pre>
30:         * </p>
31:         * @see org.junit.runner.JUnitCore
32:         */
33:        public class RunListener {
34:
35:            /**
36:             * Called before any tests have been run.
37:             * @param description describes the tests to be run
38:             */
39:            public void testRunStarted(Description description)
40:                    throws Exception {
41:            }
42:
43:            /**
44:             * Called when all tests have finished
45:             * @param result the summary of the test run, including all the tests that failed
46:             */
47:            public void testRunFinished(Result result) throws Exception {
48:            }
49:
50:            /**
51:             * Called when an atomic test is about to be started.
52:             * @param description the description of the test that is about to be run 
53:             * (generally a class and method name)
54:             */
55:            public void testStarted(Description description) throws Exception {
56:            }
57:
58:            /**
59:             * Called when an atomic test has finished, whether the test succeeds or fails.
60:             * @param description the description of the test that just ran
61:             */
62:            public void testFinished(Description description) throws Exception {
63:            }
64:
65:            /** 
66:             * Called when an atomic test fails.
67:             * @param failure describes the test that failed and the exception that was thrown
68:             */
69:            public void testFailure(Failure failure) throws Exception {
70:            }
71:
72:            /**
73:             * Called when a test will not be run, generally because a test method is annotated 
74:             * with {@link org.junit.Ignore}.
75:             * @param description describes the test that will not be run
76:             */
77:            public void testIgnored(Description description) throws Exception {
78:            }
79:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.