A frequent criticism of Tapestry, from the point of view of the Test Driven Development crowd, is that Tapestry is too hard to test ... because all your classes are abstract.
As a stop-gap measure, I've finally gotten around to creating Tapestry Test Assist. This is a simple class, that can be used inside test suites, to instantiate abstract Tapestry pages and components (or any other abstract class, for that matter).
Like Tapestry itself, the AbstractInstantiator will create new fields and methods in the subclass. Unlike Tapestry, it isn't driven by an external specification; it just finds each property that is abstract (i.e., has an abstract getter and/or setter method) and implements the property in a subclass, with a field and pair of accessor methods. Unlike Tapestry, these accessors are very simple, with no hooks into Tapestry persistent page property logic ... and that's fine for testing.
The source code is available as a zipped-up Eclipse workspace. The easiest thing is just to copy the couple of source files into your own test suite. Eventually, this will be part of the actual Tapestry distribution.
3 comments:
Howard, pls, can u giv an example of how 2 test a tapestry app/ page with test assist. i understand i would need easymock to generate a plethora of classes. it would be easier 2 achieve wit an example. the gmane tapestry-user list is not searchable and i get no useful results after searching google for tapestry testing. thanks in advance.
Hey Howard, do not forget about us: Tapestry fans. It is very important to us, XP followers, to have a well established testing platform. Please help us understanding how to use the AbstractInstatiator.
Apparently this is now part of Tapestry as the class org.apache.tapestry.test.Creator.
Post a Comment