Include pages and use them as components

You can create as many levels of subwiki hierarchies as you like: sublevels automatically inherit the parent SetUp pages. However, once you create a SetUp page in a subwiki, the parent SetUp is no longer called automatically. To execute the parent SetUp page, include it in the subwiki SetUp with an !include directive, followed by the page name.

We can also use this trick to include other pages. This allows us to create a set of utility fixtures (such as register customer, process order) and use them as components in other tests.

If the output of utility tables is not important for the particular test, consider putting them in a collapsed block using !include -c. A collapsed block is hidden by default, so it saves some screen space.

[Tip]How do I hide SetUp and TearDown?

SetUp and TearDown are included automatically in test suite pages, so you cannot use the !include -c trick or !*> syntax . However, FitNesse enables us to hide these two components by defining two special markup variables:

!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}

You can define these two variables in the main test suite page, and they will affect all subpages.

Links within a subwiki

A subwiki hierarchy is considered a namespace for links. So, for example, link BasicCase from the PurchaseTicketSuite.SetUp page leads directly to PurchaseTicketSuite.BasicCase. However, the main suite page PurchaseTicketSuite is not in the same namespace, but one level above. If you put a link named BasicCase in the main suite page, it will lead to a top-level BasicCase page. To reach a subpage, prefix the name with a caret (^BasicCase). In FitNesse release 20070619, symbols < and > are also used to point one level up or down in the hierarchy. To go to the top level, prefix a page name with a dot. So the link to .FrontPage always leads to the home page of the site. This is a good candidate to put in the common page footer (see Defining common actions).