01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.responders.run;
04:
05: import fit.Counts;
06: import fitnesse.components.CommandRunner;
07: import fitnesse.html.*;
08: import fitnesse.testutil.RegexTest;
09: import fitnesse.wiki.WikiPageDummy;
10:
11: public class TestHtmlFormatterTest extends RegexTest {
12: private HtmlPage page;
13: private TestHtmlFormatter formatter;
14:
15: public void setUp() throws Exception {
16: page = new HtmlPageFactory().newPage();
17: formatter = new TestHtmlFormatter(page);
18: }
19:
20: public void tearDown() throws Exception {
21: }
22:
23: public void testHead() throws Exception {
24: String head = formatter.head();
25:
26: assertSubString(
27: "<div id=\"test-summary\">Running Tests ...</div>",
28: head);
29: }
30:
31: public void testTestSummary() throws Exception {
32: String summary = formatter.testSummary(new Counts(4, 0, 0, 0));
33: assertSubString(
34: "<script>document.getElementById(\"test-summary\").innerHTML =",
35: summary);
36: assertSubString(
37: "<strong>Assertions:</strong> 4 right, 0 wrong, 0 ignored, 0 exceptions",
38: summary);
39: assertSubString(
40: "document.getElementById(\"test-summary\").className = \"pass\"",
41: summary);
42:
43: summary = formatter.testSummary(new Counts(4, 1, 0, 0));
44: assertSubString(
45: "<strong>Assertions:</strong> 4 right, 1 wrong, 0 ignored, 0 exceptions",
46: summary);
47: assertSubString(
48: "document.getElementById(\"test-summary\").className = \"fail\"",
49: summary);
50: }
51:
52: public void testExecutionStatusHtml() throws Exception {
53: ExecutionLog log = new ExecutionLog(new WikiPageDummy(),
54: new CommandRunner());
55: String status = formatter.executionStatus(log);
56:
57: assertSubString("<div id=\"execution-status\">", status);
58: }
59:
60: public void testTail() throws Exception {
61: String tail = formatter.tail();
62:
63: assertSubString("</html>", tail);
64: }
65: }
|