Re: Table Scanner (Re: [Htmlparser-developer] version 1.3)
Brought to you by:
derrickoswald
From: Sam J. <ga...@yh...> - 2002-12-20 09:42:05
|
Somik Raha wrote: >Sam Joseph wrote : > > > >>Have you looked at HTTPUnit? http://httpunit.sourceforge.net/ >> >>They have to deal with a lot of similar problems and there may be >> >> >synergies. > > > >I am curious to hear more about this - I am going to be using HttpUnit real >soon - what sort of problems did you face ? > I didn't face problems as such. What I mean is that HttpUnit has to contain something similar to Htmlparser somewhere in its code. Htmlparser lets you parse HTML. So does HttpUnit, but HttpUnit lets you interact with the HTML forms that you have parsed out of the HTML. For example: WebConversation o_wc = new WebConversation; WebReponse x_jdoc = o_wc.getResponse(new GetMethodWebRequest("some_url")); WebForm x_form = x_jdoc.getFormWithName("my_form"); assertTrue(x_form.hasParameterNamed("some_param")); SubmitButton x_submit_button = x_form.getSubmitButton("Submit"); x_submit_button.click(); will open a url grab the html data coming off the response, and then lets you create objects like WebForms, SubmitButtons etc. You can then manipulate these, setting parameters on the forms, submitting them etc. This is how HttpUnit allows you to create unit tests for your html interfaces. Anyway, so my point is that underneath the API HttpUnit must be doing something similar to HtmlParser in order to allow it to get access to the html data, i.e. they are both parsing HTML. The main difference is the level of the API. Currently I have had this weird idea (which I mailed to the NinJava list) which is to use the html templates that I build by web management screens from to generate java outlines for the code that handles the web forms and also the test code itself. Synchronistically, in order to implement such a thing, I would need to start of my parsing the html templates, which are themselves HTML. I guess I could use either HttpUnit or HtmlParser to do this, but I'm not sure if HttpUnit can be used to parse local files .... Anyway, for those of you reading down this far, the idea would be that you could define in one place your web form structure, and then the tedious parts of writing the support class and the test class would be removed, allowing one to produce reliable web management screens much faster. Naturally look and feel would be farmed out to CSS, and he logical extentsion would be to define your web form structures in XML, in fact to generate them directly off a data model like the ones used in Torque and Turbine .... Then providing web management screens would just be a question of choosing which forms/objects to allow which users access. Although I guess we woudl still want the ability to specify aggregate forms that gave users access to data made up of components of more fundamental data structures. Apologies for the long post ... CHEERS> SAM |