The Sub Wiki: Organizing FitNesse Pages into Hierarchies

Why Do We Need Page Hierachies?

FitNesse, you recall, is a wiki, but more than a normal one! A normal wiki is a collection of pages with a flat structure. All the pages are peers. FitNesse, on the other hand, is meant to manage many projects. We'd like each project to have its own wiki hierarchy so that name collisions can be avoided, fixture code can be found easily, etc. We might even need hierarchies within those hierarchies.

For example, project one and project two each have their own Test suites. Some of the suites might in turn contain smaller suites. These projects probably also use completely different Class path definitions. We'd like each project to be able to run acceptance tests using their own class path definitions. So we want a different class path page for each. This is what the FitNesse Sub Wiki feature makes possible.

How Sub Wiki Works

A Sub Wiki is a whole new page hierarchy that lives beneath a single FitNesse page. In fact, such a Sub Wiki is an entirely separate wiki, with an entirely separate page namespace. Any FitNesse page can be the parent of such a Sub Wiki. For example the name of this page is <UserGuide.FitNesseWiki.SubWiki. Thus, this page is the Sub Wiki page whose parent is the <UserGuide.FitNesseWiki page. (Put your mouse on each of these links and look at the bottom of the display to see where they will be directed.) For any such Sub Wiki, you could have a separate page named Sub Wiki, and FitNesse would keep them all straight (you might have some trouble, if you did not organize your page links carefully, but that's another story).

Creating a Sub Wiki

To create a sub wiki, simply create the parent page, and then add pages below it using the Add menu item, the ParentPage.SubPage syntax or the shortcut >SubPage markup language syntax.

When a sub-page is displayed, any unqualified links are assumed to be at the current level. If you want to access a global page, you need to precede the link with a dot. For example, from where we are now on this page, the link RecentChanges is really a link to .FitNesse.RecentChanges (which does not exist), whereas the link .Recent Changes is a link to the global page that contains the list of most recently changed pages.

Navigating through Sub Wikis


Test Suites: the Perfect Application of the Sub Wiki

When you organize a suite of test pages, you will naturally want to make each of the individual test pages a child page of the main suite page.

Page Headers and Footers in SubWikis

The Page Header and Page Footer classes can be used to add specific headers and footers to sub wikis. For example, the footer of this page is coming from <User Guide .Page Footer. These headers and footers can be inherited from parent pages. So if there's no Page Header or Page Footer at the current level, FitNesse will search upwards in the hierarchy until we find one. (See <User Guide .Writing Acceptance Tests .Special Pages)