Hi,
trying to test Wicket pages or components I find it sometimes
annoying to try and figure out the paths of various components.
Yes, we have the possibility to get the paths from the UI itself,
but when testing a component in isolation or a page that
can reached only with a long workflow, I feel it would be better
to have a more direct way.
In the spirit of the print(dom) utility that we have to dump
down a xml document returned by GeoServer services, I think
it would be nice to have a print(Component/Page) that prints
in text the component hierarchy, with ids, visibility status,
and eventually the model values, something like:
form
name [John]
surname [Doe]
hiddenField (h) [secret]
where the value is in square brackets and (h) marks
hidden components. We could also consider adding
a third param like the component class (optional,
so it would be print(component, showClasses, showValues))
What do you think?
I looked around but could not find such an utility
already made.
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
+1, sounds like a useful thing to have. We already have a base test class for UI tests right? GeoServerWebTestSupport or something.
Andrea Aime wrote:
Hi,
trying to test Wicket pages or components I find it sometimes
annoying to try and figure out the paths of various components.
Yes, we have the possibility to get the paths from the UI itself,
but when testing a component in isolation or a page that
can reached only with a long workflow, I feel it would be better
to have a more direct way.
In the spirit of the print(dom) utility that we have to dump
down a xml document returned by GeoServer services, I think
it would be nice to have a print(Component/Page) that prints
in text the component hierarchy, with ids, visibility status,
and eventually the model values, something like:
form
name [John]
surname [Doe]
hiddenField (h) [secret]
where the value is in square brackets and (h) marks
hidden components. We could also consider adding
a third param like the component class (optional,
so it would be print(component, showClasses, showValues))
What do you think?
I looked around but could not find such an utility
already made.
Cheers
Andrea
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
Justin Deoliveira ha scritto:
+1, sounds like a useful thing to have. We already have a base test class for UI tests right? GeoServerWebTestSupport or something.
GeoServerWicketTestSupport, which with the extra printing
method would become GeoServerAwesomeWicketTestSupport 
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
Justin Deoliveira ha scritto:
+1, sounds like a useful thing to have. We already have a base test class for UI tests right? GeoServerWebTestSupport or something.
Done.
I added a WicketHierarchyPrinter class in web2/core/src/main,
org.geoserver.web.wicket package,this allows one to use it for interactive debugging purposes too if needed.
It can be used by its utility method
WicketHierarchyPrinter.print(Component c, boolean dumpClass, boolean dumpValue)
from anywhere in the code, GeoServerWicketTestSupport also
provides its own
print(Component c, boolean dumpClass, boolean dumpValue)
that delegates to the above for shortness.
I've attached a sample output of it against NewLayerPage configured
with a store, minimal.txt contains just the ids and classes,
full.txt also the model values.
Feedback appreciated
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
(attachments)
minimal.txt (13.2 KB)
full.txt (17.2 KB)