001: /**************************************************************************/
002: /* NICE Testsuite */
003: /* A testsuite for the Nice programming language */
004: /* (c) Alex Greif 2002 */
005: /* */
006: /* This program is free software; you can redistribute it and/or modify */
007: /* it under the terms of the GNU General Public License as published by */
008: /* the Free Software Foundation; either version 2 of the License, or */
009: /* (at your option) any later version. */
010: /* */
011: /**************************************************************************/package nice.tools.testsuite.output;
012:
013: import java.io.*;
014: import java.util.*;
015:
016: import nice.tools.testsuite.*;
017:
018: /**
019: * Output logs the statements in html Format.
020: *
021: * @author Alex Greif <a href="mailto:alex.greif@web.de">alex.greif@web.de</a>
022: * @version $Id: HtmlOutput.java,v 1.6 2002/09/07 21:05:04 agreif Exp $
023: */
024: public class HtmlOutput extends AbstractOutput {
025:
026: /**
027: * Creates an instance of HtmlFormat where the formatted output
028: should be written to the specified writer.
029: *
030: * @param out TODO
031: */
032: public HtmlOutput(Writer out) {
033: super (out);
034: }
035:
036: /**
037: * Called when the application starts up.
038: *
039: */
040: public void startApplication() {
041: log("<html><head><title>Nice Testsuite</title></head><body>");
042: log("<h2>");
043: log(new Date().toString());
044: log("</h2>");
045: log("<table border=1>");
046: }
047:
048: /**
049: * Called when the application terminates.
050: *
051: */
052: public void endApplication() {
053: log("</table>");
054: log("<table><tr><td colspan=2 nowrap>");
055: log("number of testcases:</td>");
056: log("<td>"
057: + (TestNice.getTestCasesSucceeded() + TestNice
058: .getTestCasesFailed()) + "<td>");
059: log("</tr><tr>");
060: log("<td width=30> </td>");
061: log("<td>succeeded:</td><td>"
062: + TestNice.getTestCasesSucceeded() + "</td>");
063: log("</tr><tr>");
064: log("<td width=30> </td>");
065: log("<td>failed:</td><td>" + TestNice.getTestCasesFailed()
066: + "</td>");
067: log("</tr><tr>");
068: log("<td width=30> </td>");
069: log("<td>warnings:</td><td>" + TestNice.getTestCasesWarning()
070: + "</td>");
071: log("</tr></table>");
072:
073: log("</body></html>");
074: }
075:
076: /**
077: * Called when the testsuite starts to perform its testcases..
078: *
079: * @param testSuite TODO
080: */
081: public void startTestSuite(TestSuite testSuite) {
082: log("<tr><td>testsuite: " + testSuite.getFile() + "</td></tr>");
083: }
084:
085: /**
086: * Called when the testsuite finishes to perform its testcases..
087: *
088: */
089: public void endTestSuite() {
090: }
091:
092: /**
093: * Called when the testcase starts to perform.
094: *
095: * @param testCase TODO
096: */
097: public void startTestCase(TestCase testCase) {
098: mark();
099: log("<tr><td><pre>");
100: }
101:
102: /**
103: * Called when the testcase is performed.
104: *
105: * @param pass TODO
106: */
107: public void endTestCase(boolean pass) {
108: if (pass)
109: reset();
110: else
111: log("</pre></td></tr>");
112: }
113:
114: /**
115: * Returns the line break that is specific to this output.
116: *
117: */
118: protected String getLineBreak() {
119: return "<br>";
120: }
121:
122: }
|