Source Code Cross Referenced for BriefFormatter.java in  » Test-Coverage » Quilt » org » quilt » reports » 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 » Test Coverage » Quilt » org.quilt.reports 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* BriefFormatter.java */
002:
003:        package org.quilt.reports;
004:
005:        import java.io.IOException;
006:        import java.io.OutputStream;
007:        import java.io.PrintWriter;
008:        import java.io.StringWriter;
009:        import java.text.NumberFormat;
010:
011:        import junit.framework.AssertionFailedError;
012:        import junit.framework.Test;
013:
014:        import org.apache.tools.ant.BuildException;
015:
016:        import org.quilt.framework.*;
017:        import org.quilt.runner.Runner;
018:
019:        public class BriefFormatter extends BaseFormatter {
020:
021:            /** No-arg constructor. */
022:            public BriefFormatter() {
023:                results = new StringWriter();
024:                resultWriter = new PrintWriter(results);
025:            }
026:
027:            // INTERFACE FORMATTER //////////////////////////////////////////
028:
029:            /**
030:             * End the test suite: overrides basic mehod.
031:             */
032:            public void endTestSuite(QuiltTest suite) throws BuildException {
033:                StringBuffer sb = new StringBuffer("Testsuite: "
034:                        + suite.getName() + "\nTests run: " + suite.runCount()
035:                        + ", Failures: " + suite.failureCount() + ", Errors: "
036:                        + suite.errorCount() + ", Time elapsed: "
037:                        + numberFormat.format(suite.getRunTime() / 1000.0)
038:                        + " sec\n\n");
039:
040:                if (systemOutput != null && systemOutput.length() > 0) {
041:                    sb
042:                            .append("------------- Standard Output ----------------\n"
043:                                    + systemOutput
044:                                    + "------------- ---------------- ---------------\n");
045:                }
046:
047:                if (systemError != null && systemError.length() > 0) {
048:                    sb
049:                            .append("------------- Standard Error -----------------\n"
050:                                    + systemError
051:                                    + "------------- ---------------- ---------------\n");
052:                }
053:
054:                if (output != null) {
055:                    try {
056:                        output.write(sb.toString());
057:                        resultWriter.close();
058:                        output.write(results.toString());
059:                        output.flush();
060:                    } finally {
061:                        if (out != System.out && out != System.err) {
062:                            try {
063:                                out.close();
064:                            } catch (IOException e) {
065:                            }
066:                        }
067:                    }
068:                }
069:            }
070:
071:            // INTERFACE TESTLISTENER ///////////////////////////////////////
072:            /**
073:             * A test failed - overrides BasicFormattter method.
074:             */
075:            public void addFailure(Test test, Throwable t) {
076:                formatError("\tFAILED", test, t);
077:            }
078:
079:            /**
080:             * A test failed - overrides BasicFormattter method.  Interface for 
081:             * JUnit &gt 3.4. 
082:             */
083:            public void addFailure(Test test, AssertionFailedError t) {
084:                addFailure(test, (Throwable) t);
085:            }
086:
087:            /**
088:             * A test caused an unexpected error.
089:             */
090:            public void addError(Test test, Throwable error) {
091:                formatError("\tCaused an ERROR", test, error);
092:            }
093:
094:            // OTHER METHODS ////////////////////////////////////////////////
095:
096:            /** Format an error and print it. */
097:            private synchronized void formatError(String msg, Test test,
098:                    Throwable error) {
099:                if (test == null) {
100:                    resultWriter.println("Null test: " + msg);
101:
102:                } else {
103:                    endTest(test);
104:                    resultWriter.println("Testcase: " + test + ": " + msg);
105:                }
106:                resultWriter.println(error.getMessage());
107:                String strace = runner.getFilteredTrace(error, filtertrace);
108:                resultWriter.println(strace);
109:                resultWriter.println();
110:            }
111:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.