[Http-webtest-general] Re: Using Click and Hooks
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <il...@ma...> - 2002-07-31 14:30:51
|
>>>>> On Wed, 31 Jul 2002 07:47:57 -0400, "William McKee" <wi...@kn...> said: WM> On 31 Jul 2002 at 12:20, Ilya Martynov wrote: >> It is impossible right now. On the other hand it is not very hard to >> add ability to tell HTTP::WebTest which form to use. I just not sure >> about interface. How do you want to specify form to use? Form number >> on page? Form name (given that you set it with name attribute)? WM> I generally give my forms names when I have multiple forms on a WM> page. So this would be the format that I'd prefer. Can you show me WM> an example of how I would tell WebTest which form to use? I'm not sure yet. Maybe another test parameter like form_name. >> You can either set it in the perl script or in >> on_request/on_response hooks in first test block. I have plans to >> add additional hooks to be run at the begining and at the end of >> test sequence. WM> The create/destroy hooks sound like just the thing for the dbh WM> situation. In the meantime, I was hoping to see an example of WM> setting the dbh in a test block. When I pickup a cookbook, I WM> expect complete recipes <g>. Unless I missed it, the recipe for WM> querying a database is incomplete because it does not explain WM> where the Test object came from. There is not Test object. It just a variable in namespace of Test package. If you run HTTP::WebTest from script you could initialize it with $Test::dbh = DBI->connect(...); Actually you can use any namespace for variables you pass from Perl script to wtscript. Anyway you are right that this recipt is incomplete. I should rework it and explain initialization. P.S. BTW if you find yourself writing too much Perl code in wtscript files you should consider writting you own plugins and moving your Perl code into them. It is not very hard - look in sources of any of default plugins in lib/HTTP/WebTest/Plugin. -- Ilya Martynov (http://martynov.org/) |