Friday, September 18, 2009

Fitnesse and Selenium

I had decided to go with Fitnesse and Selenium as part of our Acceptance Test Framework, it was a challenge to say the least, and with the options that were out there it was bit of work and testing to find the best combination to get things to work in our environment. Basically, I am testing an update to a HealthCare Process Improvement site, nothing like being a QA person on a project like that I must say! So my tests boil down to being able to login and do certain functions, as well as just roam the site and check for pages that are not working, in the midst of this I wanted some structure so that I could do things like have login and logout before the tests so I just set up a session and do everything. Sadly, it did not work out that way.

WebTest Fixture
I went through Gojko Adzic's Web Test Fixture for Selenium and Fitnesse, this I struggled with for a little while but I liked the ability to use .Net or Java and the language to call Selenium was pretty simple. Though you have to remember to use those !'s on certain commands, something I found through trial and error with Start Browser, and it worked out pretty well. Getting Suites to work is something that I started with here, and had a lot of problems with, I kept getting fixture errors in trying to set up my suite that really became a stumbling block, seems as if I am destined never to get the fixture library to carry through the suite and putting it on every page became a problem after awhile. Biggest problem though was the version that is complete on the site is an older version of Selenium that does not work with FireFox 3, so if you have that on your machine you can either do your own buildup, or try to update the Selenium libraries in the installation. You could probably compile your own code and get things working that way as well, but its not the method I wanted to go with so I eventually gave up on it.

Fitnium
Something I came across and this worked out pretty well, moreso once I resolved my whole Login and Logout issue, and the fixture on every page problem that seems to plague me is something that carried here as well. Still, I was able to work out my issues before getting responses to my posts on the Fitnesse Yahoo Group, not sure if that is good or not but I will say its a positive that I could do it. Again a big win for me was being able to work out the fixture and suite problem here, although some of the Fitnium commands could be a little easier to remember but that I can work through.

Fitnesse
I do like the Acceptance Tests you can make, and the Suites, they will definitely help with some of the work we need to do for our product, I think my biggest issue is like what most people say - you need to write the tests. Structuring them in a logical way, or what seemed logical tome, did not work as well and gave me trouble until I used SetUp and TearDown for my tests and put the Login and Logout steps in those pages rather than the SuiteSetUp and SuiteTearDown. I don't know why that happens, but it'd be interested to know. Writing the tests can get time consuming, and I still want an easy way to get Selenium scripts to output into Wiki pages, Cory Foy's script did not work for me and I have no idea why (I don't do JavaScript much). The documentation can be confusing and incomplete, I mean where is that !r command defined? I even bought Gojko Adzic's book to help me get going, and I was able to get some nice stuff out of it, but being a doer rather than a reader I didn't get as much out of it as I thought I would, but I'm keeping it handy, who knows, I may get more into this.

Overall, it worked out well, but I would say if you are going to set these up:
  • Plan out your tests, and how you want them to work
  • Consider a few alternatives, and your Users and see what works
  • Read up on the tutorials and see if you can go through the code there, if not getting knee deep in this will only be frustrating in the future
  • Be sure these are the tools for you, Fitnesse can be daunting to a techie, and it will be moreso to a business user
Other than that, I'm glad I went through this and now have Selenium and Fitnesse working in my environment.

No comments: