Preparing your JSF webapp for testingPosted: November 6, 2007
Be it load&performance testing, be it unit-testing, it seems that all related tools have some problems with JSF’s dynamic ID-attributes.
With dynamic ID I want to indicate that the ID of a certain input-field or a button/link can change if
- no fixed id is specified (id=…)
- the page-structure changes (eg. conditionally rendered components in templates)
- real page-changes (new requirements, refactorings)
I would say a testable JSF web-application has fixed ID’s for all input- and command-components. Pure output-components like h:outputText do not need a fixed ID.
So far this is the most important testability-criteria. Of course most things can be done otherwise. But it sure is more hassle. The load&performance test-tools are more dependent on the ID-attribute because it determines also the NAME-attribute. I consider the better testability more important than the minimal time-saving by not specifying the ID-attribute.