Lessons learned from web app fitnesse testing
Web Application
We have a small web application - an end user GUI for an enterprise product. Usually web interfaces are tough to test and fitnesse was a great help for us.Test Suites can be mapped to Web pages
For about 20 jsp page application we have around 100 fitnesse tests grouped into 25 suites. There are around 1000 assertions total. Each Test Suite corresponds to a usecase usually associated with a web page. Test pages in the suite cover one of the outcomes of that use case:- TestPageStructure
- TestPageData
- TestFormSubmit test outcome 1
- test outcome 2
- test invalid input, validation message 1
- test invalid input, validation message 2
- test invalid input, validation message 3
Found defects can have regression tests
There is a separate Suite for found defects or to be precise, modification requests. We have 1 defect for 5000 lines so far after a month of manual testing. Fitnesse wiki is great to link test to other resources, like bug database.Fixture for Web Applications
As a fixture we have used slightly customized WebFixture from jwebunit project. WebFixture is a FIT fixture developed by http://jwebunit.sourceforge.net/ available only as part of the source and not binary distribution as of July 2004.There are two or three actual action fixtures with many checks to
test HTML: http://cvs.sourceforge.net/viewcvs.py/jwebunit/jWebUnit/fitplugin/checks.txt?view=auto
The WebFixture is simple and easy to use, fairly complete and browser independent. It lacks methods to verify some HTML elements. Also we had to assign some elements ids as there is not enough by name accessors.
See ^JwebUnit for configuration information. And ^JwebUnitTestExample for one example.
Infusion of fitness into a project.
It took about 15 person days to write 100% running acceptance tests. As we did it in a real life project it took 3 month of convincing, evangelizing and promoting. A month or two went to put together libraries, structure, server, backup, sample data, another server and to write a few examples. Couple of months went for helping other developers to get familiar with running and writing tests. Total of 7 month to geta pilot fitnesse project with 100 tests without much of disruption to the rest of everyday work.
People and how they take Fitnesse.
Hands-on developers start to rip the benefits first as they start refactoring without fear of breaking something. A person that had a very basic knowledge of HTML learned how to use the fixture within 2 days and can produce them at 5 a day speed for average JSP page with one form. Now we are at a stage of talking to QA to stop manual testing of our web application and start manual inspection and quality control of tests. Others started to build new test suites for a larger component. In general demo of fitnesse is well accepted, while test creation sometimes viewed as an extra work.Who should be writing acceptance tests
I see writing acceptance tests as way of defining behavior of a system to more detail then writing document requirements. Design and functional specifications also add their part to the confusion of requirement documents. By the time we would finish reading that pile together with 18 month ahead roadmap we need the project complete. Writing automated acceptance tests clears that confusion fordevelopers, benefit developers, educate developers and should be done by developers. To the extreme of if I am a professional developer I should be able to create proven to work software. Talking to integration test group I also learned that if other groups would use fitnesse too - integration tests should be easier to create.
How to test javascript and DHTML
Update 2005, May.jWebfit with Fitnesse is great for testing HTTP servers and web applications. jWebfit is based on httpunit, which can validate javascript containing on the output html. For client side applications and scripts running by web browser check out the following two opensource projects, both are test tools that run tests directly in browser.
- Selenium: http://selenium.thoughtworks.com/
- Watir: http://wtr.rubyforge.org/
[.FrontPage] [.RecentChanges]