13.7 Testing: HTTPUnit

As Mozart said, when he wrote music, the notes flowed so fluently and flawlessly onto the paper it was as if he were guided by heavenly inspiration. Alas, we ordinary mortals are bereft of this capacity when we write code, and so we must test our software before release. You can learn a lot from the TestFirst Approach (see Glossary). JUnit is a small application for testing Java methods (http://www.junit.org). It is very well suited for testing the Model classes, but unfortunately not for testing Web interfaces.

HTTPUnit (http://httpunit.sourceforge.net/) is an extension of JUnit, created to solve exactly this problem. It lets us call pages, fill forms, and click buttons. Naturally, it takes longer to set up a test than ...

Get Learning Jakarta Struts 1.2: a concise and practical tutorial now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.