!define TEST_SYSTEM {fit:A} 55
Uncle Bob has been busy with FitNesse lately. If you have been following him on Twitter or if you read his blog post on the subject, then you are aware of his work on Slim.
This post, however, is not about that. It is about something he did to make it possible to execute different tests in different VM’s.
By default, when you click on the test or suite buttons to run tests, FitNesse finds the tests it will run and executes them in a single VM.
If you want to select a particular test runner in FitNesse, you can add the following to a page:If you do not define this variable, then fit is the test system used to execute tests, making the first example redundant…almost.
These variable definitions are inherited. FitNesse will search up the page hierarchy to find variable definitions. If you do not define TEST_SYSTEM anywhere in a page’s hierarchy, then that test will be executed with fit. However, if any of the pages above the current page changed the runner to slim, then Slim will be the test runner.
The other thing that you can do is add a “logical-vm name” to the end of the runner. Here are two examples:On some page
On a different page
All tests under the page containing the first define run in a vm with the logical name vm1. The same is true for vm2.
By default (i.e., you have not defined TEST_SYSTEM anywhere), all tests are run in the same vm. More precisely:- When you click the test button, all tests executed as a result of that button click run in one VM.
- When you click the suite button, all tests executed as a result are executed in the same VM.
As soon as you introduce the TEST_SYSTEM variable, the tests might execute in the same VM or different VM’s.
Conceptually, there’s a default or unnamed VM under which all tests execute. As soon as a page contains a TEST_SYSTEM with the added :VMName syntax, that page and all pages hierarchically below it run in a different VM.
If for some reason you want to have two unrelated page hierarchies execute in the same VM, you can. Define the TEST_SYSTEM variable with the same logical VM name.
Why did he add this feature
I asked him to. He was working on that part of FitNesse so I figured he’d be able to add the feature for a project I’m working on.It has to do with service-level testing of a SOA-based solution. If you’re interested in hearing about that and the rationale for adding this feature to FitNesse, let me know in the comments and I’ll describe the background.