Don't forget the test

The new test is now available on http://localhost:8888/HelloWorld and you can browse to this URL at any time to repeat the test. However, URLs like this are easy to forget, especially when you start writing more tests. Luckily, FitNesse has a feature that makes it easier for you to find tests later. Go to the home page of the test site, click Edit, and add HelloWorld anywhere in the page. Save the page and when it reloads, you will see a link to the “Hello World” test.

FitNesse automatically converts CamelCase names into links, and all test pages in FitNesse should have CamelCase names (which is why we called the test HelloWorld). You can even add a link before you create the page: FitNesse displays a question mark next to the link and allows you to build the new page. When the page is finally created, the question mark disappears.

Figure 2.5. Failed tests are clearly marked — and both actual and expected values are displayed

Failed tests are clearly marked — and both actual and expected values are displayed

FitNesse is very strict about the page names

If you created a page (or tried to create one) and got a NullPointerException error, or the page is just not appearing, you chose a wrong name. FitNesse considers only CamelCase words as valid page names and is strict about this. The page name must start with a capital letter and contain at least one more capital letter. There is one more issue to watch out for: consecutive capital letters. FitNesse does not like them. So the capital letters in a page name must be separated by at least one lower-case letter. This convention causes a lot of headaches to FitNesse newbies, but after a while you'll get used to it. Here are some good page names:

  • HelloWorld

  • TestFluxCapacitor

  • IsPaymentWorkingCorrectly

Here are some page names that will get you in trouble:

  • helloworld (no capital letters)

  • Testfluxcapacitor (just one capital letter)

  • isPaymentWorkingCorrectly (starts with a lower-case letter)

  • TestFCapacitor (two consecutive capital letters)