[Http-webtest-general] Re: Passing optional parameters
Brought to you by:
m_ilya,
richardanderson
From: William M. <wi...@kn...> - 2003-09-10 13:02:02
|
On Wed, Sep 10, 2003 at 12:49:50PM +0400, Ilya Martynov wrote: > >>>>> On Tue, 9 Sep 2003 14:59:46 -0400, William McKee <wi...@kn...> said: > > WM> Hi list, > WM> I have been using the following code to set my URL in each of my > WM> wtscript files: > > WM> on_start { > WM> URL = http://www.yahoo.com > ^^^^^^ > > Typo? It should $URL. Yeah, there were several typos in that example. I was going by memory (usu. a bad thing <g>). The working code looks like: on_start = { $URL = 'http://www.yahoo.com' } > User error :) Test parameters are not visible as perl variables in a > test. They are different things. Figures! Can you give me more explanation of what can be passed in as an optional parameter. The docs don't define it very clearly. > But you can do something like > > $MY::URL = 'http://www.yahoo.com'; > $webtest->run_wtscript($file); > > and in your tests use > > url = "$MY::URL/purchase.cgi" Thanks for the code but it did not work for me. I'm using WebTest v2.03. Does this example only work for 2.04? > I'll consider adding a feature which would make passing Perl variables > to tests easier. Something like > > $webtest->run_wtscript($file, { perl_vars =< {URL => $URL}}); That would be a nice feature for me, but I'd be happy with a usable workaround as well. Thanks, William -- Knowmad Services Inc. http://www.knowmad.com |