Fitnesse - Selenium integration struggles

Cirilo Wortel

Recently I was challenged by a client to test a new web application in an Agile project. The team was new at working Agile and even more with working together with a functional tester, altogether this resulted in me getting very little development support from the team.
Because the lack of tooling and support I focussed my efforts on just recording test-scripts using Selenium IDE, hoping I would be able to reuse them once I got the development support I had been requesting. The plan was to integrate the pre-recorded scripts in a more extended test environment in a later stage of the project.

After having studied what my options were for successfully automating the test environment, I formulated a strategy to undertake this. Being used to having a powerful framework like Fitnesse, with Selenium IDE I missed about all the functionality to operate on the domain of the application itself. Such as test preparations steps, database access and calls directly to server processes. Besides using Selenium IDE by itself simply does not support the use of any other browser besides Firefox and the customer expected the application to be running on any browser and explicitly requested it to be tested on at least IE6/7, Firefox and Safari.

Quite a lot of blogs can be found on the net on how to integrate Fitnesse with Selenium. There is even the webtest fixture in Fitnesse that sets the basis for this integration.  All that is necessary is a fixture that is capable of calling Selenium and the pre-recorded Selenium scripts would have to be converted in a format that Fitnesse can understand. Fitnesse would than call Selenium RC enabling the browser support that was necessary for the job.

When a Xebia colleague joined the project things sped up and I got my implementation. It took him little time to write the fixtures I needed. In our experiment we found that in order for Fitnesse to work with selenium scripts, just a very simple driver could do the trick, the most important part was the ability for Fitnesse to understand the different Selenium commands. Fitnesse version 3.x contains a script fixture that makes it very simple to create a logical script in a readable way, that could also be based upon the pre-recorded Selenium scripts. A groovy script did the translation, the makeup of the script needed just minor adjustments to conform with the Wiki table and some basic commands that are used in Selenium IDE differ from what Selenium RC uses, so these needed translating.

That pretty much does the trick!

When I actually started using it I ran into some odd problems. For instance, when you try to test across domain borders, from our website to another and back (in our case this was a internet payment provider), Selenium RC just stopped with some unclear error, while IDE had worked perfectly fine. Again my colleague came to the rescue. At home he did some investigating and got the thing working. We just need to set the -proxyInjectionMode as we where working behind a proxy at the customer site.
Yet again this did not solve the problem entirely, Selenium ended in a strange session exception. Whenever Selenium crossed the domain it would start a new session, loosing the proxy settings of the original browser session. Now this problem was a bit more tricky, after doing extensive research we found that every-time firefox started a new session it did it from blank profile, causing our proxy settings to be lost. Turned out the guys from Selenium already implemented the solution to this problem, we just had to point it to the correct Firefox profile template using the -firefoxProfileTemplate parameter.

So the final startup command turned out to be something like:
java -jar selenium-server.jar   -firefoxProfileTemplate /Users/cirilowortel/Library/Application\ Support/Firefox -proxyInjectionMode'

 

Comments (6)

  1. Seu Enium - Reply

    April 23, 2009 at 3:20 pm

    You can use *chrome instead of *firefox. It resolves all the problems about changing domains during the navigation.
    About Fitnesse integration with Selenium, I've used it for a while but I haven't like it. Debugging in Fitnesse is awful and web tests generally crash and you have to debug.

  2. Rob Fletcher - Reply

    April 23, 2009 at 5:02 pm

    What kind of 'agile' team has a separate tester writing functional tests? Why aren't the devs doing it?

    • Cirilo Wortel - Reply

      April 27, 2009 at 8:11 am

      Hi Rob,
      In this team the developers were just doing unit testing. We have found that adding a functional tester to our teams is a recipe for success and if done correctly makes additional acceptance testing by the customer redundant. Also a tester can focus more on the business while the developers can fully focus on technical issues. This is for us a proven strategy, besides in my opinion testing and developing are just two different specialties.

  3. Derek Neighbors - Reply

    April 23, 2009 at 7:21 pm

    It is nice to see how other agile teams are approaching functional testing. Please keep sharing.

  4. Powers Foss - Reply

    April 29, 2009 at 8:12 pm

    I have also combined FitNesse with Selenium RC to form the basis of our automated functional test strategy. It works quite well and we have a team of nearly 30 QA testers authoring their tests in FitNesse utilizing Java fixture wrappers around the Selenium calls. We've found that with only a basic knowledge of XPath, the majority of the QA team can be productively automating tests without any programming experience. This keeps the so-called "test automation team" size down to a very small number (3) needed to support the functional tests, any custom fixtures, and execute the load & performance testing.

  5. Keith Sterling - Reply

    May 9, 2009 at 8:15 am

    Guys,

    I have a full DSL implementation of Selenium in Fitnesse available for all to use at http://www.magneticreason.com/tools/fitnium/fitnium.html

    Keith

Add a Comment