On Wednesday, December 25, 2002, at 02:34 AM, Sam Joseph wrote:
> Pardon me for not hving read the HTML spec in detail. I don't have
> any html coders except myself. I wasn't aware that people had to be
> familiar with every aspect of the HTML spec in order to use it. I'm
> sure that it's use would not be as widespread as it is if everyone had
> to know the spec off by heart.
Obviously you don't. browsers tend to ignore the ID settings except
are not unique.
> Personally I am trying to write some code that automates the creation
> of test cases and support classes directly from html templates. You
> can read about it in a previous mail to this list.
> A problem that I have, along with others, is that changes in html
> layout break our tests, forcing re-writes of tests whenever the GUI
> changes - very inefficient. Excuse me while I scream in frustration
> at the fact that I must specify the row and column location of
> something in a table, when all I want to do is get the set of cells
> that correspond to the results of a query made during the submission
> of the form.
I understand the problem. What I have done in such cases is to rely on
column positions, which tend not to change much after you ignore the
blank cells. In fact, the bulk of the early work on HttpUnit was
intended to make exactly this kind of testing easy.
> I am currently using a system that queries RDF triples. I get back
> lists of subjects, predicates and objects. If I am testing a query
> where I ask for all the triples where the subject is "John" it would
> be very helpful to be able to confirm that all the triples displayed
> include the subject "John". Thus setting id="SUBJECT" on every cell
> that is displaying a subject allows me to check that the result is
> correct without having to rewrite my test every time I, or some html
> designer, changes the layout of my table.
> I would be very interested if you had any suggestions about how to
> achieve this without setting the id in multiple cells to the same
The simplest way is to have each result in a separate row, with the
order (non-blank column number) fixed. If you call
WebTable.purgeEmptyCells and then WebTable.asText you will get a two
dimensional array which is easy to check, and which will not be broken
when people add   cells for formatting purposes (a very common
practice). Among the problems with the approach you are suggesting is
that of identifying which cells constitute a triple. Guaranteeing that
they are in the same row (or same column, if you prefer) solves this
and makes the page a lot more readable.
Now there is a way to designate a class of similar cells in HTML. You
use the "class" attribute. At present this is not supported by
HttpUnit, but is on the list of upcoming features.