[Webtest] [dev] Best way to extend WebTest configuration possibilities

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Thu, 22 Feb 2007 13:46:42 +0100


Hi,

currently we have basically 4 kinds of possibilities to configure WebTest:
(a) using one of the existing <config> attributes
(b) using a System property (like webtest.connectioninitializer)
(c) calling a static helper method like XPathHelper.registerGlobalXxxx
(d) using a script step within <webtest> to configure the running test

WT-270 (http://webtest-community.canoo.com/jira/browse/WT-270) contains 
a patch from Thomas Kappen following way (a) to allow to specify the 
class name of a custom PageCreator. This way is fully valid but first I 
fear that too many configuration options have the same right to belong 
to config than PageCreator. Second this requires having the custom class 
present in the classpath.

What about defining a key like "webtest.hotspot.pageCreator" and using 
it to look in Project's reference map for a customized entry? (for info: 
an Ant Project can contain references to any kind of objects in this 
map) WebTest could look at it during configuration and use the page 
creator it finds there if any. Major advantage: it would be possible to 
define a custom page creator on the fly with for instance a small Groovy 
script. This strategy could be used for other extension points. The only 
"issue" here concern the documentation. I can imagine adding new xdoclet 
tags to generate this documentation automatically and to keep it accurate.

Any thoughts?

Marc.