Fwd: Re: [Web-SIG] Client-side support: what are we aiming for?

Moof moof at metamoof.net
Sat Oct 25 06:00:22 EDT 2003


John J Lee wrote:

 > On Fri, 24 Oct 2003, Moof wrote:


 >> [moaning about unit testing with webware and cheetah]

 > Isn't it the fault of the framework you're using if it doesn't make unit
 > testing easy?


Quite so. However I'm appealing to say that whatever we develop here be 
reasonable to use when we're trying to simulate requests and responses 
for unit tests...

 > Still, I guess it's true that HTML parsing is a necessary
 > part of some unit tests (not only functional tests).



 >
 >> So a standard HTML parser would be nice, as well as keeping TDD in mind
 >> when we design request and response (and possibly session) objects.
 >
 >
 >
 > We already have an HTML parser (two, in fact).


Bill seems to be talking about this elsewhere.

 >> > The parsing doesn't have to be very intelligent or do validation,
 >> HTML > syntax is fairly simple.
 >> > I think that does belong in the standard library.
 >>
 >>
 >> Speaking of validation, a sort of standard form validation library would
 >> be nice: something to say "I'm expecting this value to be an int between
 >> 1-31" or "I'm expecting this to be a string with the following legal
 >> characters" and so on. It's not that difficult to write yourself, but I
 >> seem to find myself reinventing the wheel every time I do. A standard
 >> "best practice" way of doing this would be wonderful.
 >
 >
 >
 > I guess that would look similar to ClientForm?  If not, what?


Nonono, though that could be useful for some sort of automated testing, 
the thought hadn't even occurred.

When somebody fills in a form, the browser will return a string either 
as a GET or POST method with all the values filled in, which we seem to 
have decided elsewhere should be returned as a dictionary to the 
programmer. I want a nice standard way of saying field 'fromDay' in this 
dictionary should be an integer between 1 and 31. That 'fromMonth' 
should be an integer between 1 and 12. That 'username' should contain 
only ascii letters and numbers and this small amount of punctuation, and 
should be no shorter than x characters, and no longer than y characters 
which is what I set the length limit to on the form. That sort of thing. 
I should be able to get a list of errors that I can associate with the 
various fields, process them into intelligible sentences I can throw 
back at the user as errors on the page.

Yes, you can do this from javascript on the same page, but this is for 
people who either have javascript turned off, or aren't necessarily 
using my page as input as it's been hijacked form elsewhere, or 
someone's trying to be malicious.

Moof
-- 
            Giles Antonio Radford, a.k.a Moof
Sympathy, eupathy, and, currently, apathy coming to you at:
                 <http://metamoof.net/>






More information about the Web-SIG mailing list