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.HtmlPage;
08: import fitnesse.html.HtmlPageFactory;
09: import fitnesse.testutil.AbstractRegex;
10: import fitnesse.wiki.MockWikiPage;
11:
12: public class TestHtmlFormatterTest extends AbstractRegex {
13: private HtmlPage page;
14:
15: private TestHtmlFormatter formatter;
16:
17: public void setUp() throws Exception {
18: page = new HtmlPageFactory().newPage();
19: formatter = new TestHtmlFormatter(page);
20: }
21:
22: public void tearDown() throws Exception {
23: }
24:
25: public void testHead() throws Exception {
26: String head = formatter.head();
27:
28: assertSubString(
29: "<div id=\"test-summary\">Running Tests ...</div>",
30: head);
31: }
32:
33: public void testTestSummary() throws Exception {
34: String summary = formatter.testSummary(new Counts(4, 0, 0, 0));
35: assertSubString(
36: "<script>document.getElementById(\"test-summary\").innerHTML =",
37: summary);
38: assertSubString(
39: "<strong>Assertions:</strong> 4 right, 0 wrong, 0 ignored, 0 exceptions",
40: summary);
41: assertSubString(
42: "document.getElementById(\"test-summary\").className = \"pass\"",
43: summary);
44:
45: summary = formatter.testSummary(new Counts(4, 1, 0, 0));
46: assertSubString(
47: "<strong>Assertions:</strong> 4 right, 1 wrong, 0 ignored, 0 exceptions",
48: summary);
49: assertSubString(
50: "document.getElementById(\"test-summary\").className = \"fail\"",
51: summary);
52: }
53:
54: public void testExecutionStatusHtml() throws Exception {
55: ExecutionLog log = new ExecutionLog(new MockWikiPage(),
56: new CommandRunner());
57: String status = formatter.executionStatus(log);
58:
59: assertSubString("<div id=\"execution-status\">", status);
60: }
61:
62: public void testTail() throws Exception {
63: String tail = formatter.tail();
64:
65: assertSubString("</html>", tail);
66: }
67: }
|