Chapter 10. Working in a team

One of the best features of FitNesse is that it promotes a collaborative way of working. Now is the time to learn how to set up and use FitNesse in a team environment. In this chapter we also consider various options for server deployment and configuration and discuss how to integrate FitNesse with automated build tools and build servers.

Options for team setup

There is no general agreement on how best to use FitNesse as a team tool so we review pros and cons for the three most popular options rather than suggest a one-size-fits-all solution.

  • Using a single central server

  • Importing tests from a remote wiki

  • Storing tests in a version control system

Choose the one that fits your team the best.

Using a single central server

In view of the fact that FitNesse works like a web server, it's only natural to think about setting up a single central test server so that team members can use the server from any machine in the network with a browser.

Technically, a single FitNesse server is capable of supporting a multi-user environment. FitNesse has an internal version control system that keeps track of test revisions, and it automatically saves a backup when pages change. Old versions are archived into ZIP files. It can also track and authenticate named users.[24] However, FitNesse cannot automatically pull files from an external repository and commit them - you will have to write scripts for that yourself. So, if you want a central test system, you will probably want to set up a periodic build on the same machine, so that the latest code is always available for testing. Because tests are executed using an external program, no object code is cached and you just need to update the DLLs for tests to pick up the latest version of your code.

[Tip]How secure is FitNesse?

I find that it is easier to secure FitNesse at the firewall or load balancer level than at the application level. FitNesse is not a high-load general-purpose web server: it is a specialised web server intended to help people to write tests more easily in a collaborative environment. So I recommend that you do not count too much on the service itself providing top-notch security.

Although this setup might seem like the natural choice, in practice it works only for small teams. FitNesse does not perform well when people are running tests simultaneously. It was designed to make test management easier, not to be a scalable and robust general-purpose web server. If the central system has a separate build process then developers have to commit incomplete or untested code into the main branch for the server to see it. Another option would be to allow developers to upload their DLLs to the test server, but this is only practical for the smallest teams. Even with only three or four people uploading DLLs, there can be a lot of problems due to version conflicts.

Importing tests from a remote wiki

Another option is to use one central server for collaboration but execute tests on local FitNesse installations on developer machines. The central server coordinates updates and allows FitNesse on developer machines to take the latest test scripts using a wiki import. Tests are never executed on the central server, so there are no issues with server code builds nor with concurrent test runs. Developers can import test pages to a local server. Instead of one Edit button on the left, FitNesse shows two buttons for imported pages: Edit Locally and Edit Remotely. These two buttons enable developers to update a test script just on their machine or globally.

To import tests from a remote wiki you first create the page to serve as a root for the import hierarchy (putting !contents -R as the page content might be a good idea; see Group related tests into test suites). Then go to page properties and enter the remote wiki URL in the URL field in the “Import Wiki” section. You can import an entire hierarchy or any sublevel (just point to the correct subwiki URL). For more details of this feature, see http://fitnesse.org/FitNesse.UserGuide.WikiImport

This approach requires an identical setup for local FitNesse servers on all developer systems, in order to avoid problems with different disk paths to DLLs on various machines.

Since different version control systems are used for the test scripts (central FitNesse server) and project code, occasionally there are version conflicts between code and tests if several people are working on the same modules at the same time. So developers should edit the test scripts locally and then, when all code changes are complete, send the updates to the central server. In practice, local test updates often do not find their way back to the central server. However, with a bit of discipline, this can be a good setup for a smaller team.

Storing tests in a version control system

Since most team projects use a version control system for code anyway, another common approach is to use the version control repository for storing tests instead of the central server. Test files (and often the entire FitNesse server setup) are stored in the main version control system, along with the source code. Developers start FitNesse from the local copy of the repository, and run tests locally on their machines.

The benefit of this method is that there is no conflict between code and test script versions. Everything is in the same repository. When the project folder is committed to the version control system, test scripts are committed too. Test scripts are plain text files, so modern version control systems can merge most concurrent changes correctly. This also makes maintenance easier, because there is just one code repository to back up. Finally, because the FitNesse server is also included in the repository, relative paths to project DLLs are always the same. These issues may not be important for a smaller team, but make a huge difference for larger teams.

The downside of this method is that the internal version control system in FitNesse starts getting in the way. Automatic archiving just causes headaches by polluting the version control with hundreds of ZIP files. Some very useful FitNesse functions like test refactoring simply cannot be used in a folder-based system like CVS or Subversion. FitNesse deletes and moves complete test folders during refactoring, including hidden .cvs and .svn files, which completely confuses folder-based version control systems.

Also, not having a central server leaves people like business analysts and customers outside the loop, because they typically do not have tools to access the version control system (or cannot be bothered to start FitNesse locally on their machines). This can be solved with an additional “central” test server for people who cannot run FitNesse on their machines. The central server is not used for wiki imports, but acts as a documentation reference. It can also be used by the continuous integration server to verify the build (see Continuous integration).

In any case, if tests are kept in an external version control repository, you should turn off internal archiving by adding -e 0 to the command used for starting FitNesse. To avoid lots of reports about conflicting changes, it is also a good idea to exclude ErrorLogs and RecentChanges directories (in the wiki) from version control.

If you use a central server backed by an external version control system, it is a good idea to restart FitNesse after tests are updated. Although the DLL code is not cached, FitNesse caches test scripts and other page content. Unless the server is restarted you might not see some updates straight away.

It might also be a good idea to configure the central server as a Windows service (see Can FitNesse start automatically with Windows? ), so that it loads automatically and that other services can restart it when needed.

[Note]Stuff to remember
  • There are several options to set up FitNesse for a team environment. You can use a single central server, remote wiki import with local FitNesse instances or store test files in an external version control system.

  • Having a central server makes sense even if you store files in an external version control system, so that business people can use FitNesse without installing anything.

  • Use Windows resource kit utilities to set up FitNesse as a system service on the central server.

  • Deploy DLLs in the folder where your test runner is to make sure that reflection and serialisation works.

  • Integrate FitNesse into your automated build process so that tests are executed even when people forget to do that.

  • Don't mix quick and slow tests so that developers can run through basic verifications on every change.

  • Separate code-oriented and customer-oriented tests so that non-technical people do not get confused.

  • Use the root page to configure FitNesse for running .NET tests by default.

  • When integrating with continuous build tools, make sure to delete old test results so that they do not get mixed with new ones.

  • FitNesse.NET test runner does not produce XML results in the format that CruiseControl expects, so you have to reformat them using the Java test runner.