Setting up FitNesse for DataFlex

Download FitNesseForDataFlex

My recommendation is to use Git or Mercurial and clone the repo from https://bitbucket.org/olaeld/fitnessefordataflex

This will ensure that you also get the required subrepo, DataFlexPatterns.

For Mercurial, this is how to do it: First install TortoiseHg, then go to C:\Projects. Right-click, select TortoiseHg, and Clone… In Source, you enter https://bitbucket.org/olaeld/fitnessefordataflex and select “Clone”.

The alternative is to select Download Repository from the Downloads section of these repos. (You will need to manually download both repos, unzip them, and place them in appropriate folders.)

Compile the FitNesseRunner

In this example, we place the project in C:\Projects\FitNesseforDataFlex.

In DataFlex Studio, open the workspace “FitNesse Example Workspace\FitNesse Example.sws”

I  prefer to use precompilation, to reduce compile time. If you want to do the same, open the file FitNesseRunnerPrecompile.pkg in Studio, select Project -> Precompile -> Precompile Package <FitNesseRunnerPrecompile.pkg>.

Now compile the project itself, and upon running it, you should get the following message:

“No workspace has been specified. Start the program from FitNesse. Check the docs for further info.”

Now, close this message, and if a security warning appears, tell the Windows Firewall that it’s ok for fitnesserunner.exe to communicate on the network.

The program should now look like this:

fitnesserunner

But we haven’t started the FitNesse framework itself, so for the time being we will close this program.

Install FitNesse

From Fitnesse.org, you can download fitnesse-standalone.jar. This is a Java executable, so the Java run-time needs to be installed. The file goes into the FitNesse folder, i..e C:\Projects\fitnessefordataflex\FitNesse.

Finally, before you can run fitnesse-standalone.jar, you need to “unblock” it.

Run FitNesse

Run the batch file C:\Projects\fitnessefordataflex\FitNesse\StartFitnesse.bat

This will run fitnesse-standalone.jar, with the parameter -p 8081, instructing FitNesse to use port 8081. The first time you run FitNesse, it will create the folder FitNesseRoot, which is where the contents for the wiki is located, and where your tests will be located.

FitNesseFirstTime

You can point the browser to http://localhost:8081 to see that FitNesse is running.

FitNesseRunningFirstTime

But before you are ready to go, you need to tell FitNesse to use the FitNesseForDataFlex integration.

Setting up FitNesse to use FitNesseForDataFlex

Close the command line window that is running FitNesse.

Copy the contents of the folder “copy contents to FitNesseRoot after it has been created” to FitNesseRoot, and choose to overwrite existing files.

Run StartFitNesse.bat again, and point your browser to http://localhost:8081.

You will now see that there is a link to DataFlexTests.

DataFlexTests

Also, if you click on the root link at the bottom of the page, you will find that certain settings have been set:

FitNesseRoot

These settings tell FitNesse to use the Slim protocol, which exe file to run (TEST_RUNNER = FitNesseRunner.exe), which workspace the program should use (COMMAND_PATTERN), and finally the “classpath”, which is the class name prefix for the FitNesse fixture classes that will mediate between FitNesse and your production code.

Running your first test

Open the DataFlexTests page, and go to Division Test.

DivisionTest

Now, select the Test link at the top of the page. If all goes well, the FitNesseRunner will execute this test, exercising a DataFlex class called cFitnesseDivision, and calling the Quotient function with the parameters numerator and denominator given in the tables.

DivisionTestRun

You will see that the tests go green on the FitNesse web page.

Congratulations, you have successfully installed and run FitNesseForDataFlex.

Now it’s time to test your own software!

Advertisement

Published by

Ola Eldøy

I started programming in 1985 when I got my first computer, a Dragon 32.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s