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;
04:
05: import fitnesse.testutil.AbstractRegex;
06: import fitnesse.testutil.FitNesseUtil;
07: import fitnesse.wiki.InMemoryPage;
08: import fitnesse.wiki.PageCrawler;
09: import fitnesse.wiki.PathParser;
10: import fitnesse.wiki.WikiPage;
11:
12: public class TestRunnerTest extends AbstractRegex {
13: private fitnesse.TestRunner runner;
14:
15: private PageCrawler crawler;
16:
17: public void setUp() throws Exception {
18: WikiPage root = InMemoryPage.makeRoot("RooT");
19: crawler = root.getPageCrawler();
20: crawler.addPage(root, PathParser.parse("ClassPath"),
21: "!path classes");
22: crawler.addPage(root, PathParser.parse("FrontPage"),
23: "front page");
24: FitNesseUtil.startFitnesse(root);
25:
26: runner = new fitnesse.TestRunner();
27: }
28:
29: public void tearDown() throws Exception {
30: FitNesseUtil.stopFitnesse();
31: System.setOut(System.out);
32: }
33:
34: public void testParseArgs() throws Exception {
35: String[] args = new String[] {};
36: assertFalse(runner.acceptAgrs(args));
37:
38: args = new String[] { "blah", "http://localhost/FrontPage" };
39: assertFalse(runner.acceptAgrs(args));
40:
41: args = new String[] { "http://localhost/FrontPage" };
42: assertTrue(runner.acceptAgrs(args));
43: assertFalse(runner.verbose);
44: assertFalse(runner.showHtml);
45:
46: args = new String[] { "-v", "-h", "http://localhost/FrontPage" };
47: assertTrue(runner.acceptAgrs(args));
48: assertTrue(runner.verbose);
49: assertTrue(runner.showHtml);
50: }
51: }
|