FitNesse is dead – Long live FitNesse

Wow, we have been so busy for the last 7 weeks i haven’t had time to update the blog at all, also it has been pointed out to me that the instructions for getting up and running with FitNesse wont work as is because i made some assumptions, so i will re hash that post soon and add a download that contains a ready-2-run FitNesse instance complete with working examples.

So what have we been up to?

ThoughtWorks are back, and this time people who didn’t get exposure to the Agile way on the last project are running the project this time. We have also gone “all out” so we are doing the whole pair programming and BA and QA paring thing which meant we had to radically change our physical environment to accommodate such practices.

The TW test lead on the project had suggested we try their new tool “Twist” instead of FitNesse, and i thought, oh right another sales pitch, and asked them “what is the problem we have today that using Twist will solve”. Answer? we have out grown FitNesse.

When i looked at the main fixture we are using for most of our tests (the webtest fixture) we had extended it that much, that 75% of the code in there was ours! So i had to evaluate why are we using FitNesse?? Answer, because it was a quick and easy way (not really that easy) to implement automated browser testing for our last project. Now however, we have a good understanding of driving selenium (born out of fixing the [apparent] inadequacies of webFixture [for our needs at least]).
So with our new skills (the ability to write tight reusable selenium tests), why would we want to preserve FitNesse?

Anyone who has read my ramblings will (hopefully) have read my post [i hate fitNesse / FitNesse Rocks], so you should be aware that we have a torrid love hate relationship with FitNesse already. There are lots of things wrong with FitNesse. A lack of historical test metrics is just one feature, but my main gripe is this:

FitNesse -> Fit -> Fixture -> Selenium

That is just too much overhead (read bloat). If we have the skills to write solid selenium tests directly then that’s what we should do:

OurTests -> selenium

It is more important now because we want to run the tests as part of an automated build pipeline, and every millisecond counts. In the time it takes FitNesse to start up, i can run 3 raw selenium tests. ergo i need to take FitNesse and Fit out of the equation.

But wait that’s not all…

As i’ve stated before, not all of my team posses the skills required to dive straight into the Java code and write selenium tests (nor do i want them to, they are testers and not developers after all). This is where FitNesse scores its points. It allows a non coder to write the tests in english prose (or near enough) and a coder and intrument the tests afterwards. However, when you begin to work like this versioning can become problematic very quickly. The problem becomes exasperated when a broken QA test causes the automated build to fail.

So what can Twist do that FitNesse cant?

Twist is built upon the Eclipse IDE with some important additions. Our developers already use Eclipse, and so we have been using Eclipse to maintain the webfixture. ergo, we are comfortable using Eclipse. It has CVS (SVN via an add on) integration built in, so that’s versioning problem we had with FitNesse taken care of, but the real power of twist is its ability to allow non tech people (like BAs for example) to write prose like acceptance tests and save them, without writing any code.

A tester or developer can then check out the test on his Twist instance and instrument the test (Note: This can be achieved by recording the test in firefox via the selenium plug-in). So we still have the ability of writing tests in “English”, but without having to learn any Wiki mark-up (bonus, also you don’t have to be precious about what characters is in your test, as it wont be interpreted as wiki mark-up), and as soon as the test is instrumented it can be saved to the code repository and hey presto the version control is taken care of and the latest version of the test can be used in the automated build.

And finally the lack of historical test metrics. Because we will run the tests as part of the build, historical metrics are taken care of. The build server will maintain the metrics against each build, and the builds will be frequent.

However. Twist is still in Beta. Its a licensed product so we have to stump up some cash, and there will be another learning curve for us to tackle. We have had “fun” today trying to get it to launch selenium using our proxy with a list of hosts to ignore.

Our next challenge is to get the output of the build metrics displayed on a moving message LED display so that the culprit of a broken build will be named and shamed…

FitNesse is dead – Long live FitNesse

Wow, we have been so busy for the last 7 weeks i haven’t had time to update the blog at all, also it has been pointed out to me that the instructions for getting up and running with FitNesse wont work as is because i made some assumptions, so i will re hash that post soon and add a download that contains a ready-2-run FitNesse instance complete with working examples.

So what have we been up to?

ThoughtWorks are back, and this time people who didn’t get exposure to the Agile way on the last project are running the project this time. We have also gone “all out” so we are doing the whole pair programming and BA and QA paring thing which meant we had to radically change our physical environment to accommodate such practices.

The TW test lead on the project had suggested we try their new tool “Twist” instead of FitNesse, and i thought, oh right another sales pitch, and asked them “what is the problem we have today that using Twist will solve”. Answer? we have out grown FitNesse.

When i looked at the main fixture we are using for most of our tests (the webtest fixture) we had extended it that much, that 75% of the code in there was ours! So i had to evaluate why are we using FitNesse?? Answer, because it was a quick and easy way (not really that easy) to implement automated browser testing for our last project. Now however, we have a good understanding of driving selenium (born out of fixing the [apparent] inadequacies of webFixture [for our needs at least]).
So with our new skills (the ability to write tight reusable selenium tests), why would we want to preserve FitNesse?

Anyone who has read my ramblings will (hopefully) have read my post [i hate fitNesse / FitNesse Rocks], so you should be aware that we have a torrid love hate relationship with FitNesse already. There are lots of things wrong with FitNesse. A lack of historical test metrics is just one feature, but my main gripe is this:

FitNesse -> Fit -> Fixture -> Selenium

That is just too much overhead (read bloat). If we have the skills to write solid selenium tests directly then that’s what we should do:

OurTests -> selenium

It is more important now because we want to run the tests as part of an automated build pipeline, and every millisecond counts. In the time it takes FitNesse to start up, i can run 3 raw selenium tests. ergo i need to take FitNesse and Fit out of the equation.

But wait that’s not all…

As i’ve stated before, not all of my team posses the skills required to dive straight into the Java code and write selenium tests (nor do i want them to, they are testers and not developers after all). This is where FitNesse scores its points. It allows a non coder to write the tests in english prose (or near enough) and a coder and intrument the tests afterwards. However, when you begin to work like this versioning can become problematic very quickly. The problem becomes exasperated when a broken QA test causes the automated build to fail.

So what can Twist do that FitNesse cant?

Twist is built upon the Eclipse IDE with some important additions. Our developers already use Eclipse, and so we have been using Eclipse to maintain the webfixture. ergo, we are comfortable using Eclipse. It has CVS (SVN via an add on) integration built in, so that’s versioning problem we had with FitNesse taken care of, but the real power of twist is its ability to allow non tech people (like BAs for example) to write prose like acceptance tests and save them, without writing any code.

A tester or developer can then check out the test on his Twist instance and instrument the test (Note: This can be achieved by recording the test in firefox via the selenium plug-in). So we still have the ability of writing tests in “English”, but without having to learn any Wiki mark-up (bonus, also you don’t have to be precious about what characters is in your test, as it wont be interpreted as wiki mark-up), and as soon as the test is instrumented it can be saved to the code repository and hey presto the version control is taken care of and the latest version of the test can be used in the automated build.

And finally the lack of historical test metrics. Because we will run the tests as part of the build, historical metrics are taken care of. The build server will maintain the metrics against each build, and the builds will be frequent.

However. Twist is still in Beta. Its a licensed product so we have to stump up some cash, and there will be another learning curve for us to tackle. We have had “fun” today trying to get it to launch selenium using our proxy with a list of hosts to ignore.

Our next challenge is to get the output of the build metrics displayed on a moving message LED display so that the culprit of a broken build will be named and shamed…

New look – Same Old Blog

I was becoming frequently frustrated by the design constraints of the template i had chosen. Whenever i needed to share long lines of code (FitNesse Mark-up) they would wrap or truncate on screen.

I have solved this by using a very simple layout (all of the articles are still here) and i have implemented dp.SyntaxHighlighter by Alex Gorbatchev

If your not seeing pretty “HighLighted” code snips like this:

you are probably blocking the functionality with an AdBlocker or some such.

New look – Same Old Blog

I was becoming frequently frustrated by the design constraints of the template i had chosen. Whenever i needed to share long lines of code (FitNesse Mark-up) they would wrap or truncate on screen.

I have solved this by using a very simple layout (all of the articles are still here) and i have implemented dp.SyntaxHighlighter by Alex Gorbatchev

If your not seeing pretty “HighLighted” code snips like this:

you are probably blocking the functionality with an AdBlocker or some such.

FitNesse and User Authentication

So i have a need to secure our FitNesse instance. FitNesse has built in security, and i have begun to look at that more closely, I’m really only posting this here to serve as an aide mémoire. I will update the post as i progress with the topic.

As described on http://fitnesse.org/FitNesse.StartingAndStoppingFitNesse

To start FitNesse with security enabled and get the username and password form a
text file called password.txt

To create a file called password.txt and add a user into the file.


java -cp fitnesse.jar fitnesse.authentication.Password -f password.txt $FITNESSE_USERNAME

It is usual to use your login id as $FITNESSE_USERNAME.
This would allow you to map the environment variables $LOGNAME or $USER on UNIX or
%USERNAME% under Windows to the FitNesse username.

For stopping fitnesse from command-line when authentication has been enabled:


java -cp fitnesse.jar fitnesse.Shutdown [...more-options] -c $FITNESSE_USERNAME $PASSWORD

FitNesse and User Authentication

So i have a need to secure our FitNesse instance. FitNesse has built in security, and i have begun to look at that more closely, I’m really only posting this here to serve as an aide mémoire. I will update the post as i progress with the topic.

As described on http://fitnesse.org/FitNesse.StartingAndStoppingFitNesse

To start FitNesse with security enabled and get the username and password form a
text file called password.txt

To create a file called password.txt and add a user into the file.


java -cp fitnesse.jar fitnesse.authentication.Password -f password.txt $FITNESSE_USERNAME

It is usual to use your login id as $FITNESSE_USERNAME.
This would allow you to map the environment variables $LOGNAME or $USER on UNIX or
%USERNAME% under Windows to the FitNesse username.

For stopping fitnesse from command-line when authentication has been enabled:


java -cp fitnesse.jar fitnesse.Shutdown [...more-options] -c $FITNESSE_USERNAME $PASSWORD

Getting started with FitNesse

A few other colleagues have been trying FitNesse, and hitting the same problems we did.

Lets be frank, the documentation that comes with FitNesse inst great for a beginner, so i have written a brief “how to” (see below) that should get you up and running.

This isn’t a step by step hold your hands tutorial (and i haven’t found one on the internet either), it assumes you have some level of technical Schwartz and i assume you are using windows (if you are using linux, you should be able to translate without problem). I am alos talking about testing in java here, i wont be covering the .NET tests.

Some Handy Links:

The guy (gojko) who wrote WebTest and Dbfit fixtures, writes a blog which contains a wealth of info.

The Webtest Reference is a must read if you are going to use that fixture, but it is better to print out and pin up.

Steps to create your first test suite.

Installing:

Do you have java installed?
FitNesse is written in Java so you need to have Java installed on your PC to be able to use Fitnesse. If you don’t know if you have Java installed, open a command prompt, and tytpe the following

java -version

If you have java installed you should see a message similar to


H:>java -version
java version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode)

it doesn’t matter too much if the message isn’t exactly the same, but if you get the following message


'java' is not recognized as an internal or external command,
operable program or batch file.

then you don’t have java installed (or you might have but its not in your path, either way fitnesse isn’t going to run until java works for you).

The download of fitnesse will give you a zip file fitnesse.zip.
You should unpack it anywhere you like. But c: would be best. if you extract it with folder names it will create a fitnesse directory for you.
Go to that directory and double click on run.bat
You should get a message saying that FitNesse started.
You can then start up your browser and go to http://localhost

Note: when you clicked on the run.bat you have got a warning from windows firewall you should allow or unblock fitnesse as it runs a webserver so it needs to have access.

If you get an error, you may have a web server running on your machine already, using port 80. If this is the case you can specify a different port for fitnesse to run on, like 8080, you can achieve this by going to the fitnesse directory and typing:

java -cp fitnesse.jar fitnesse.Fitnesse -p 8080

Then navigate to it in your web browser. (http://127.0.0.1:8080/)

if this works for you, simple edit the run.bat file and add your port preference in there.

Beefing it up

We now need to install the webfixture. This is the thing that will save us from having to write java code, its taxonomy is also a little warmer than raw selenese.

visit http://www.fitnesse.info/webtest and download the java binaries only package. It will be a jar file.

once downloaded you need to navigate to your fitnesse folder, again i’m assuming its c:fitnesse and create a new folder in there called lib

inside lib place the downloaded webfixture jar file.

Now get a copy of selenium from http://selenium-rc.seleniumhq.org/download.jsp

i should point out here that i still use version 092 because there are a few flaky things with the newer versions that could leave you pulling out your hair.

Again, place the jar ….

Okay, so i should mention here that if you are behind a proxy, you need to specify that in your selenium start up command.
Creating a test:

Now you have fitnesse up and running you can browse its pages. As you can see there is some content in there already.

To create a new test suite just type the name of the suite in CamelCase in the address bar your browser, e.g lets say i’m going to call my suite MyFirstSuite, i would type

http://127.0.0.1:8080/MyFirstSuite

into the address bar of my browser.

Fitnesse will tell you the page doesn’t exist and give you the option of creating it (the newer version just gives you the edit window, in which case just paste in the path info below).

Before we can write any tests we have to tell fitnesse where we will be storing our libraries by putting the path information into the suite page. In this example I assume you are putting all your jars (selenium, webtest, dbfit) into a folder called lib inside the fitnesse folder.

In the newly created page (type into the edit box) i would type:

!path lib*.jar

Then i add the fitnesse wiki mark-up command to generate a contents list automatically (this is just me being lazy).

!contents -R

and now save the page (click the save button).

Note: If you want your SetUp and TearDown pages to be collapsed on your test pages you can define the variables:


!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}

in the same page too. If you dont know what that means, just move on, dont worry.

Now we have a suite page we need to tell fitnesse that the page is to be treated as a suite. Click the properties button on the left menu. If the properties button is not available on the left menu, then type ?properties at the end of the url in your browser:

http://127.0.0.1:8080/MyFirstSuite?properties

From within the properties page make sure the “suite” checkbox is checked and uncheck the buttons you don’t want to appear in your left hand menu (I never use the files, refactor, search or versions button, so I turn these off but I enable edit if its not already).

Now we need to create the setup and teardown pages for our suite, again we can just type the names at the end of the url in the browser preceded with a ‘.’ period:

http://127.0.0.1:8080/MyFirstSuite.SetUp

Within the SetUp page we declare the fixture we are using for the test, e.g the WebTest fixture

!|com.neuri.webfixture.WebTest|

The exclamation mark tells the wiki not to parse the text in the cell, otherwise is would look for a page called WebTest and think you want to create that page.

You can then put the startup command for selenium here, so for webtest (refer to the reference you printed out above) we use:


|Start Browser|firefox|With Selenium Console On|localhost|At Port|4444|And Scripts At|http://www.bbc.co.uk/|

Note: you would substitute the values for the selenium console (localhost) and its port (4444) depending on what machine you are driving and how you set selenium up. Here I’m assuming you are running the selenium server on your own machine, and it started on port 4444 (the default). But if you have a bit of savvy you should have just realise that you can drive any selenium instance remotely.

You can now save the SetUp page and create the TearDown page in the same way as we created the SetUp page, by typing the page name into the browser:

http://127.0.0.1:8080/MyFirstSuite.TearDown

We only need to put one thing in here, the instruction to shutdown the browser we opened in the SetUp page. again refer to the reference.

|shutdown browser|

Okay, now we have an empty suite.

Ok. Now lets create the test page, in the same way we created the other pages above, by typing the url:

http://127.0.0.1:8080/MyFirstSuite.TestOne

In here we will add a basic test using the WebTest reference to guide us:

Navigate to a URL during the test (change active page)

|user opens url|http://www.bbc.co.uk/radio2|

Check that the page loads fully within given time (use after user opens url)

|page reloads in less than|10|seconds|

Check current browser URL

|page url is|http://www.bbc.co.uk/radio2/|

Check that page contains some text (regardless of whether text is visible or not)

|element|title|contains text|BBC - Radio 2 - Home|

Save the page.

Edit the pages properties, either by the properties button on the left, or (if the button isn’t available) by typing ?properties at the end of the url in the browsers address bar:

http://127.0.0.1:8080/MyFirstSuite.TestOne?properties

You can select the option you want, but make sure “Suite” is not checked, and “Test” is checked. Save the page.

You should now find that your test has the SetUp page and TearDown page included.

If selenium is running you should be able to run the test by clicking “test” on the menu.

There you have it, your first test suite. Try now to add TestTwo to your test suite.

Getting started with FitNesse

A few other colleagues have been trying FitNesse, and hitting the same problems we did.

Lets be frank, the documentation that comes with FitNesse inst great for a beginner, so i have written a brief “how to” (see below) that should get you up and running.

This isn’t a step by step hold your hands tutorial (and i haven’t found one on the internet either), it assumes you have some level of technical Schwartz and i assume you are using windows (if you are using linux, you should be able to translate without problem). I am alos talking about testing in java here, i wont be covering the .NET tests.

Some Handy Links:

The guy (gojko) who wrote WebTest and Dbfit fixtures, writes a blog which contains a wealth of info.

The Webtest Reference is a must read if you are going to use that fixture, but it is better to print out and pin up.

Steps to create your first test suite.

Installing:

Do you have java installed?
FitNesse is written in Java so you need to have Java installed on your PC to be able to use Fitnesse. If you don’t know if you have Java installed, open a command prompt, and tytpe the following

java -version

If you have java installed you should see a message similar to


H:\>java -version
java version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode)

it doesn’t matter too much if the message isn’t exactly the same, but if you get the following message


'java' is not recognized as an internal or external command,
operable program or batch file.

then you don’t have java installed (or you might have but its not in your path, either way fitnesse isn’t going to run until java works for you).

The download of fitnesse will give you a zip file fitnesse.zip.
You should unpack it anywhere you like. But c:\ would be best. if you extract it with folder names it will create a fitnesse directory for you.
Go to that directory and double click on run.bat
You should get a message saying that FitNesse started.
You can then start up your browser and go to http://localhost

Note: when you clicked on the run.bat you have got a warning from windows firewall you should allow or unblock fitnesse as it runs a webserver so it needs to have access.

If you get an error, you may have a web server running on your machine already, using port 80. If this is the case you can specify a different port for fitnesse to run on, like 8080, you can achieve this by going to the fitnesse directory and typing:

java -cp fitnesse.jar fitnesse.Fitnesse -p 8080

Then navigate to it in your web browser. (http://127.0.0.1:8080/)

if this works for you, simple edit the run.bat file and add your port preference in there.

Beefing it up

We now need to install the webfixture. This is the thing that will save us from having to write java code, its taxonomy is also a little warmer than raw selenese.

visit http://www.fitnesse.info/webtest and download the java binaries only package. It will be a jar file.

once downloaded you need to navigate to your fitnesse folder, again i’m assuming its c:\fitnesse and create a new folder in there called lib

inside lib place the downloaded webfixture jar file.

Now get a copy of selenium from http://selenium-rc.seleniumhq.org/download.jsp

i should point out here that i still use version 092 because there are a few flaky things with the newer versions that could leave you pulling out your hair.

Again, place the jar ….

Okay, so i should mention here that if you are behind a proxy, you need to specify that in your selenium start up command.
Creating a test:

Now you have fitnesse up and running you can browse its pages. As you can see there is some content in there already.

To create a new test suite just type the name of the suite in CamelCase in the address bar your browser, e.g lets say i’m going to call my suite MyFirstSuite, i would type

http://127.0.0.1:8080/MyFirstSuite

into the address bar of my browser.

Fitnesse will tell you the page doesn’t exist and give you the option of creating it (the newer version just gives you the edit window, in which case just paste in the path info below).

Before we can write any tests we have to tell fitnesse where we will be storing our libraries by putting the path information into the suite page. In this example I assume you are putting all your jars (selenium, webtest, dbfit) into a folder called lib inside the fitnesse folder.

In the newly created page (type into the edit box) i would type:

!path lib\*.jar

Then i add the fitnesse wiki mark-up command to generate a contents list automatically (this is just me being lazy).

!contents -R

and now save the page (click the save button).

Note: If you want your SetUp and TearDown pages to be collapsed on your test pages you can define the variables:


!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}

in the same page too. If you dont know what that means, just move on, dont worry.

Now we have a suite page we need to tell fitnesse that the page is to be treated as a suite. Click the properties button on the left menu. If the properties button is not available on the left menu, then type ?properties at the end of the url in your browser:

http://127.0.0.1:8080/MyFirstSuite?properties

From within the properties page make sure the “suite” checkbox is checked and uncheck the buttons you don’t want to appear in your left hand menu (I never use the files, refactor, search or versions button, so I turn these off but I enable edit if its not already).

Now we need to create the setup and teardown pages for our suite, again we can just type the names at the end of the url in the browser preceded with a ‘.’ period:

http://127.0.0.1:8080/MyFirstSuite.SetUp

Within the SetUp page we declare the fixture we are using for the test, e.g the WebTest fixture

!|com.neuri.webfixture.WebTest|

The exclamation mark tells the wiki not to parse the text in the cell, otherwise is would look for a page called WebTest and think you want to create that page.

You can then put the startup command for selenium here, so for webtest (refer to the reference you printed out above) we use:


|Start Browser|firefox|With Selenium Console On|localhost|At Port|4444|And Scripts At|http://www.bbc.co.uk/|

Note: you would substitute the values for the selenium console (localhost) and its port (4444) depending on what machine you are driving and how you set selenium up. Here I’m assuming you are running the selenium server on your own machine, and it started on port 4444 (the default). But if you have a bit of savvy you should have just realise that you can drive any selenium instance remotely.

You can now save the SetUp page and create the TearDown page in the same way as we created the SetUp page, by typing the page name into the browser:

http://127.0.0.1:8080/MyFirstSuite.TearDown

We only need to put one thing in here, the instruction to shutdown the browser we opened in the SetUp page. again refer to the reference.

|shutdown browser|

Okay, now we have an empty suite.

Ok. Now lets create the test page, in the same way we created the other pages above, by typing the url:

http://127.0.0.1:8080/MyFirstSuite.TestOne

In here we will add a basic test using the WebTest reference to guide us:

Navigate to a URL during the test (change active page)

|user opens url|http://www.bbc.co.uk/radio2|

Check that the page loads fully within given time (use after user opens url)

|page reloads in less than|10|seconds|

Check current browser URL

|page url is|http://www.bbc.co.uk/radio2/|

Check that page contains some text (regardless of whether text is visible or not)

|element|title|contains text|BBC - Radio 2 - Home|

Save the page.

Edit the pages properties, either by the properties button on the left, or (if the button isn’t available) by typing ?properties at the end of the url in the browsers address bar:

http://127.0.0.1:8080/MyFirstSuite.TestOne?properties

You can select the option you want, but make sure “Suite” is not checked, and “Test” is checked. Save the page.

You should now find that your test has the SetUp page and TearDown page included.

If selenium is running you should be able to run the test by clicking “test” on the menu.

There you have it, your first test suite. Try now to add TestTwo to your test suite.

Connecting to Oracle Grid with DbFit

While there is a good deal of info on the DbFit website, there is little about connecting to Oracle databases. The examples given didn’t help us at all because we used two nodes in our grid, and we have to give both of them in our connection string (if one node doesn’t respond the test will use the other).

!|Connect|(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=node1.grid.domain.net)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=node2.grid.domain.net)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=WEB1_DEFAULT_SERVICE)))| UserName | PassWord |

As you can see you can end up with a very long row in your table, but it does connect.