FitNesse Beginner Tips February 15, 2009
From the previous post of FitNesse, Getting Started with FitNesse, we covered how to setup FitNesse and see it in action by creating our first Fixture and test case. Now before investing a lot of time trying to write fixtures and test cases that would do some real testing, there are a few more things you can do that can help you with your development.
Setting up your path
In out first test case example, we added a few lines to the beginning of the test case that looked like this:
!path lib/fitnesse.jar !path lib/fitlibrary.jar !path build/testautomation.jar
These lines tell FitNesse where to look for Fixtures that are called in the test case and its dependent libraries. If you do not add these lines, you will probably get some error saying
Could not fix Fixture: FIXTURENAME.
Now, instead of specifying this in every test case, its best to define it in the root fitnesse page. This way all the children pages automatically use the same settings. To do this edit the
testautomation/fitnesse/content.txt file and add the following lines in the file:
!path lib/*.jar !path build/testautomation.jar
Once this is done, rest of your test cases should work without having to define the path of your Fixtures.
Checking in your files
By now most of you have probably figured out roughly what your project layout should be, and even if you don’t, it makes sense to check in your work so far in your Source Control Management tool. The question then is, what files should we begin checking in. Here are some guidelines:
- Check in all your java source. However in most cases you shouldn’t check in your compiled class or jar file. The only exception is when you want your end users to use a “deployed” version of your project.
- Check-in your FitNesse wiki pages. Your wiki pages are represented as
properties.xml. In your Wiki page folders, you might also see zip files. These zip files represent different versions of the test cases as you edit these wiki pages. You shouldn’t need them if you are using a Source Control Management system to manage different versions of the wiki pages.
- During the first FitNesse start-up, FitNesse looks for images and stylesheet files it needs for the look and feel for the wiki site. If they don’t exist, it creates it. For this reason, you dont need to check-in these files. These are created under a directory called
filesin the fitnesse root folder. If you followed the layout suggested in the Creating your Java project workspace post, then the folder path would be
- When you execute tests, it creates all the result files under the
ErrorLogsfolder under the fitnesse root directory. You do not need to check these files in either.
- All other files, like your build.xml, config files or library files should be checked in.