http-webtest-general Mailing List for HTTP-WebTest (Page 8)
Brought to you by:
m_ilya,
richardanderson
You can subscribe to this list here.
| 2002 |
Jan
(1) |
Feb
(6) |
Mar
(2) |
Apr
(3) |
May
(6) |
Jun
(10) |
Jul
(24) |
Aug
(19) |
Sep
(8) |
Oct
(33) |
Nov
(11) |
Dec
(5) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(20) |
Feb
(4) |
Mar
(28) |
Apr
(18) |
May
(6) |
Jun
|
Jul
(23) |
Aug
(5) |
Sep
(11) |
Oct
(29) |
Nov
(24) |
Dec
(10) |
| 2004 |
Jan
(2) |
Feb
(4) |
Mar
(40) |
Apr
(4) |
May
(8) |
Jun
(13) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
| 2005 |
Jan
(1) |
Feb
(7) |
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Terry <td...@ya...> - 2003-07-08 17:30:02
|
Hello,
I am seeing some huge speed problems when hitting
sites that do a browser check ( at least that is what
I am seeing at this point ). I first thought it was
an ssl issue but I can hit yahoo's ssl login site
normally. I have tried playing with the user_agent
parameter, for example:
Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x
4.90; DigExt)
Any other ideas? I can hit the page fine with lynx.
It eventually gives me:
STATUS CODE CHECK
Expected '200' and got: 500 Can't connect to
www.foo FAIL
Thanks!
=====
Terry
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
|
|
From: William M. <wi...@kn...> - 2003-07-07 22:18:26
|
On Mon, Jul 07, 2003 at 02:04:38PM -0700, bruce wrote: > Is there a way to configure web tests so that they display > the full HTML of the fetched page, only when a test fails? Sure, use the 'terse=failed_only' setting. It works great! William -- Knowmad Services Inc. http://www.knowmad.com |
|
From: Brian W. <bw...@ya...> - 2003-07-07 21:37:09
|
Hello, I noticed that HTTP::WebTest::Request module reformats that url during the tests. I have run into a problem when using wt to test web pages that redirect you to another web page. I am trying to test the return code of a url that looks something like: http://website.com?http://website2.com?var=val It appears that HTTP::WebTest::Request::uri is encoding everything after the first question mark. This behavior is different than HTTP::Request::uri and consequently, web test reports a 403 error instead of a 200. If I manually remove the uri method from HTTP::WebTest::Request (so it will use the method from the base class), then the test returns a 200 code. Is there an easy way to tell HTTP::WebTest::Request::uri to behave the same as HTTP::Request? Is there another way to get the test to succeed for this url? Thanks. - Brian __________________________________ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com |
|
From: bruce <br...@ir...> - 2003-07-07 21:04:53
|
Is there a way to configure web tests so that they display
the full HTML of the fetched page, only when a test fails?
I've been using this code snippet to dump the full HTML:
on_response = { my $webtest = shift; my $content = $webtest->current_response->content; print $content; [] }
Is there a variable I can check from on_response to see if any
of the other tests failed?
If there's no easy way to do this, I guess I could extend the show_html
variable to have a "failed_only" option, like the "terse" variable.
Has anyone tried this?
thanks,
-Bruce
|
|
From: William M. <wi...@kn...> - 2003-07-03 19:23:05
|
Well, it turns out that redirection requests that preserve header info (e.g., POSTs, cookies, etc.) are a bit of a mess[1]. There does not seem to be any clear consensus on whether or not clients should[2] or should not[3] support preserving the headers on a redirect. Apparently LWP has sided on the latter option and does not resend headers on a redirect. The newsgroups have several examples of debug output that seem to point to this same conclusion so I'll spare ya'll the gory details. What results when a page that sets a cookie redirects to another page without sending the cookie (e.g., a login page), duplicate cookies are created. One suggestion is to use an intermediary page with a meta refresh tag[2]. Since I'm using Perl to develop my web application, I was able to avoid the need to generate this extra page and instead was able to call the necessary subroutine that displayed the desired page upon a successful login. Thanks again for your prompt assistance in helping me debug my situation. HTTP::WebTest is fantastic. William [1] http://ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html [2] http://archives.real-time.com/rte-tomcat/2000/May/msg01599.html [3] http://www.west-wind.com/wckb/redirectsandcookiesandsessions.htm -- Knowmad Services Inc. http://www.knowmad.com |
|
From: William M. <wi...@kn...> - 2003-07-03 18:19:12
|
On Thu, Jul 03, 2003 at 07:52:00PM +0400, Ilya Martynov wrote: > BTW what is hostname of your server? IIRC LWP used to *not* send > cookies for servers which do not have at least two dots in their > hostname. I.e. it will not send cookies for server hostnames like > localhost. Well, that could definitely be the problem then. I just looked in the docs for LWP and didn't see anything about this. However, I did some tests using the lwp-request agent and have discovered that the problem with sending cookies on a redirect is in the LWP code itself. I also discovered that this problem is present when using a local or external hostname. I will post a message to the LWP list and see if I can learn anything further. Thanks for you assistance so far, William -- Knowmad Services Inc. http://www.knowmad.com |
|
From: Ilya M. <il...@ip...> - 2003-07-03 15:52:05
|
>>>>> "WM" == William McKee <wi...@kn...> writes: WM> Actually, looking at my server files (I'm using CGI::Session::File to WM> handle session variables and it uses cookies to track the session id), WM> the received cookie is the one that is received *after* the redirect. If WM> I were to trace the code to find out if webtest is getting the cookie WM> from the webserver, what subroutine should I be watching? You can try to add debug logging in HTTP::WebTest::Cookies in sub extract_cookies() which is called when LWP tries to extract cookies from HTTP headers of HTTP response and store them in cookie jar and in sub add_cookie_header() which is called when LWP reads cookie jar and adds cookie HTTP headers in HTTP response. BTW what is hostname of your server? IIRC LWP used to *not* send cookies for servers which do not have at least two dots in their hostname. I.e. it will not send cookies for server hostnames like localhost. -- Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |
|
From: William M. <wi...@kn...> - 2003-07-03 15:40:58
|
Hi Ilya,
Thanks for the tarball. I just ran the tests and all worked fine.
I even installed your new code but I'm still getting problems with my
tests. The output reports that webtest gets a cookie but is not sending
one back.
---
SENT COOKIE(S)
*** none ***
RECEIVED COOKIE(S)
SID=4d532a508ea50871adf9cb1c443b1083; path=/; expires=Sat, 02-Aug-2003 15:31:27 GMT
----
Actually, looking at my server files (I'm using CGI::Session::File to
handle session variables and it uses cookies to track the session id),
the received cookie is the one that is received *after* the redirect. If
I were to trace the code to find out if webtest is getting the cookie
from the webserver, what subroutine should I be watching?
Thanks,
William
--
Knowmad Services Inc.
http://www.knowmad.com
|
|
From: William M. <wi...@kn...> - 2003-07-03 15:14:14
|
On Thu, Jul 03, 2003 at 03:25:55PM +0400, Ilya Martynov wrote: > WebTest should send cookies in redirects. I even added a new test case > to its test suite to verify it and it passes on my computer. On the > other hand WebTest depends on LWP to send cookies correctly so it > might be a bug in the version of LWP you have. Try to upgrade > LWP. Also you can try to take CVS version of WebTest and run its 'make > test' - if your local setup has problem it should catch it. Hi Ilya, Thanks for the quick response. My version of LWP is the latest according to CPAN. I tried to do an anon checkout from SourceForge but I'm getting errors. Could you send me a tarball of the latest development tree? Thanks, William -- Knowmad Services Inc. http://www.knowmad.com |
|
From: Ilya M. <il...@ip...> - 2003-07-03 11:26:02
|
>>>>> "WM" == William McKee <wi...@kn...> writes: WM> I am having a problem with a redirect while doing my webtesting. It WM> appears the WebTest is not resending cookies when it is doing a WM> redirect. This does not appear to be the typical behavior of web WM> browsers as they work fine with my website. Can anyone confirm this WM> behavior? Is this correct behavior for a web client? WebTest should send cookies in redirects. I even added a new test case to its test suite to verify it and it passes on my computer. On the other hand WebTest depends on LWP to send cookies correctly so it might be a bug in the version of LWP you have. Try to upgrade LWP. Also you can try to take CVS version of WebTest and run its 'make test' - if your local setup has problem it should catch it. -- Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |
|
From: William M. <wi...@kn...> - 2003-07-02 18:31:20
|
I am having a problem with a redirect while doing my webtesting. It appears the WebTest is not resending cookies when it is doing a redirect. This does not appear to be the typical behavior of web browsers as they work fine with my website. Can anyone confirm this behavior? Is this correct behavior for a web client? Thanks, William -- Knowmad Services Inc. http://www.knowmad.com |
|
From: Sean O'N. <so...@ci...> - 2003-07-01 11:53:16
|
>@ sign is treated as literal. When value of parameter is not inclosed in quotes it is always >treated literal. Thank you, Ilya. This is what I was looking for. I didn't know if @ was treated as a literal in params. I'm sure the problem is with me leaving out a piece in the form querystring. Sean -----Original Message----- From: Ilya Martynov [mailto:il...@ip...]=20 Sent: Tuesday, July 01, 2003 3:50 AM To: Sean O'Neill Cc: htt...@li... Subject: Re: [Http-webtest-general] wt script file - email address in params >>>>> "SO" =3D=3D Sean O'Neill <so...@ci...> writes: SO> I am using the WebTest module and have created a test script to=20 SO> submit a web form.=A0=A0 One of the text box fields on the web form=20 SO> requires entry of an email address.=A0 On submit, the form will=20 SO> process the page and send an email to the=A0address=A0submitted with = the SO> form.=A0 When I include the email address in the params section of = the SO> script, the script succeeds, but no email is sent. SO> Here is a code snipet and the script test results: SO> test_name =3D Submit Test SO> =A0 click_button =3D Submit SO> =A0 params =3D ( name =3D> Joe SO> =A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0 email =3D> js...@my... ) SO> =A0 regex_require =3D (=A0Email confirmation sent ) SO> end_test SO> Here is a snipet from the script run results: SO> URL:=20 SO> = http://www.somedomain.com/form1.plx?name=3DJoe&email=3Djsmith%40mydomain SO> .com SO> Is this problem due to the params section of code not interpreting=20 SO> the "@" sign as a literal?=A0 Do I need to use some combo = of=A0quotes=20 SO> around the email address in params? @ sign is treated as literal. When value of parameter is not inclosed in quotes it is always treated literal. And result URL is correct - it is just that @ was URL escaped there. Technically URLs like http://domain/?param=3D@ and http://domain/?param=3D%40 are exactly equivalent. Could it be a problem that your script requires form submited using POST instead of GET or it needs additional params? --=20 Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |
|
From: Ilya M. <il...@ip...> - 2003-07-01 07:50:38
|
>>>>> "SO" =3D=3D Sean O'Neill <so...@ci...> writes: SO> I am using the WebTest module and have created a test script to SO> submit a web form.=A0=A0 One of the text box fields on the web form SO> requires entry of an email address.=A0 On submit, the form will SO> process the page and send an email to the=A0address=A0submitted with SO> the form.=A0 When I include the email address in the params section SO> of the script, the script succeeds, but no email is sent. SO> Here is a code snipet and the script test results: SO> test_name =3D Submit Test SO> =A0 click_button =3D Submit SO> =A0 params =3D ( name =3D> Joe SO> =A0=A0 =A0=A0=A0=A0=A0=A0=A0=A0=A0 email =3D> js...@my... ) SO> =A0 regex_require =3D (=A0Email confirmation sent ) SO> end_test SO> Here is a snipet from the script run results: SO> URL: http://www.somedomain.com/form1.plx?name=3DJoe&email=3Djsmith%40my= domain.com SO> Is this problem due to the params section of code not interpreting the = "@" SO> sign as a literal?=A0 Do I need to use some combo of=A0quotes around th= e email SO> address in params? @ sign is treated as literal. When value of parameter is not inclosed in quotes it is always treated literal. And result URL is correct - it is just that @ was URL escaped there. Technically URLs like http://domain/?param=3D@ and http://domain/?param=3D%40 are exactly equivalent. Could it be a problem that your script requires form submited using POST instead of GET or it needs additional params? --=20 Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |
|
From: Sean O'N. <so...@ci...> - 2003-07-01 03:21:35
|
I am using the WebTest module and have created a test script to submit a
web form. One of the text box fields on the web form requires entry of
an email address. On submit, the form will process the page and send an
email to the address submitted with the form. When I include the email
address in the params section of the script, the script succeeds, but no
email is sent.
Here is a code snipet and the script test results:
test_name = Submit Test
click_button = Submit
params = ( name => Joe
email => js...@my... )
regex_require = ( Email confirmation sent )
end_test
Here is a snipet from the script run results:
URL: http://www.somedomain.com/form1.plx?name=Joe
<http://www.somedomain.com/form1.plx?name=Joe&email=jsmith%40mydomain.co
m> &email=jsmith%40mydomain.com
Is this problem due to the params section of code not interpreting the
"@" sign as a literal? Do I need to use some combo of quotes around the
email address in params?
Thanks in advance,
Sean O.
|
|
From: Ilya M. <il...@ip...> - 2003-05-21 11:47:56
|
>>>>> "B" == bruce <br...@ir...> writes: B> I suspect this would be a frequently asked question, but I can't B> find the answer in the cookbook nor in the mailing list archives, B> so here goes. B> [..snip..] B> By default, WebTest will attempt to click a link found on the B> "http://localhost/accountoptions" page for each of these tests, and so B> all but the first one will fail. What is the easiest way to modify B> the wtscript so that the click_link commands cascade? I'd prefer _not_ B> to have to inject "url =" tests throughout, if that's possible. WebTest should chain click_link tests correctly. If it doesn't it is a bug. Can you send me output of your test with test parameter 'show_html = yes' so I can see the HTML code of pages you are testing. -- Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |
|
From: bruce <br...@ir...> - 2003-05-19 18:41:50
|
I suspect this would be a frequently asked question, but I can't
find the answer in the cookbook nor in the mailing list archives,
so here goes.
I would like to have a series of tests where each page is reached
from clicking a link on the previous page. Thus, the tests would
look something like this:
test_name = Account options page
url = http://localhost/accountoptions
text_require = ( Account Options )
end_test
# click a link on the accountoptions page
test_name = unsubscribe page
click_link = Remove a game from your subscription
text_require = ( Remove a Game )
end_test
# click a link on the unscubscribe page
test_name = unsubscribe from game 1
click_link = Unsubscribe
params = ( id => 1 )
text_require = ( Confirm unsubscribe from )
end_test
# click a link on the confirmation page
test_name = confirm unsubscribe
click_link = Confirm Unsubscription
text_require = ( You have been unsubscribed )
end_test
By default, WebTest will attempt to click a link found on the
"http://localhost/accountoptions" page for each of these tests, and so
all but the first one will fail. What is the easiest way to modify
the wtscript so that the click_link commands cascade? I'd prefer _not_
to have to inject "url =" tests throughout, if that's possible.
-- Bruce
|
|
From: Ilya M. <il...@ip...> - 2003-05-13 08:19:06
|
>>>>> "JW" == Jieming Wang <Jie...@en...> writes: JW> Hi, JW> Can you do cookies the same way that you do with text_require ? i.e., JW> cookies_require = ( JW> cookie1=value1 JW> domain1=.mydomain.com JW> . JW> . JW> ) JW> or, simply just JW> cookies_require = ( JW> some strings to be matched... JW> ) No, there is not builting support for this. But you can use my example for header checks I've just posted to test cookies. After all cookies are just a HTTP header 'Set-Cookie'. -- Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |
|
From: Ilya M. <il...@ip...> - 2003-05-13 08:18:03
|
>>>>> "JW" == Jieming Wang <Jie...@en...> writes:
JW> Another quesiton:
JW> I have web server that generates customized headers:
JW> MY_HEADER1=value1
JW> MY_HEADER2=value2
JW> ...
Do you mean
MY_HEADER1: value1
MY_HEADER2: value2
?
Your example doesn't look like a HTTP headers.
JW> Is there any easy way to check if the headers are generated and returned ?
There is no builtin support for header checks. You can use Perl
code (untested) to test it using Hooks plugin:
plugins = ( ::Hooks )
test_name = Header Checks
url = ....
on_response = {
my $webtest = shift;
my $response = $webtest->current_response;
[ $response->header('MY_HEADER1') == 'value1' ? 'yes' : 'no',
'Have got correct MY_HEADER1 header',
$response->header('MY_HEADER2') == 'value2' ? 'yes' : 'no',
'Have got correct MY_HEADER2 header'
];
}
end_test
Such checks should be probably supported in core. I'll consider
implementing support for them in future versions.
--
Ilya Martynov, il...@ip...
CTO IPonWEB (UK) Ltd
Quality Perl Programming and Unix Support
UK managed @ offshore prices - http://www.iponweb.net
Personal website - http://martynov.org
|
|
From: Jieming W. <Jie...@en...> - 2003-05-12 14:45:00
|
Another quesiton:
I have web server that generates customized headers:
MY_HEADER1=value1
MY_HEADER2=value2
...
Is there any easy way to check if the headers are generated and returned ?
Thanks.
Jieming
-----Original Message-----
From: Jieming Wang
Sent: Sunday, May 11, 2003 10:19 PM
To: 'htt...@li...'
Subject: how to check required cookies
Hi,
Can you do cookies the same way that you do with text_require ? i.e.,
cookies_require = (
cookie1=value1
domain1=.mydomain.com
.
.
)
or, simply just
cookies_require = (
some strings to be matched...
)
Thanks.
Jieming
|
|
From: Jieming W. <Jie...@en...> - 2003-05-12 02:19:02
|
Hi,
Can you do cookies the same way that you do with text_require ? i.e.,
cookies_require = (
cookie1=value1
domain1=.mydomain.com
.
.
)
or, simply just
cookies_require = (
some strings to be matched...
)
Thanks.
Jieming
|
|
From: Ilya M. <il...@ip...> - 2003-04-14 13:22:05
|
>>>>> "GF" == Gerry Finkel <ga...@cs...> writes: GF> Illya, GF> Sorry I haven't responded - I got sidetracked for a week. GF> I think it's good enough for me to know that this should be working; I GF> assume I just have a bug in my code. I'd rather not waste your time GF> trying to debug my code (although if you're interested, I'm quite GF> willing to mail it all to you). I'm curious, so, yes, please send it me. Though I don't promise anything :) GF> I hadn't looked into plugins yet. Perhaps that's the way I should be GF> going, since the more time I spend at this, the more code I write in the GF> on_response hook. I guess that's where I'll head now... Too much code in on_response hooks is definetely bad smell and moving it in plugins is definetely better idea. The reason is simple: plugins are ordinary Perl modules so it is easier to reuse and test this code. -- Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |
|
From: Gerry F. <ga...@cs...> - 2003-04-14 12:03:06
|
Illya, Sorry I haven't responded - I got sidetracked for a week. I think it's good enough for me to know that this should be working; I assume I just have a bug in my code. I'd rather not waste your time trying to debug my code (although if you're interested, I'm quite willing to mail it all to you). I hadn't looked into plugins yet. Perhaps that's the way I should be going, since the more time I spend at this, the more code I write in the on_response hook. I guess that's where I'll head now... Thanks for your help. Gerry On Fri, 04 Apr 2003 00:05:24 +0400 Ilya Martynov <il...@ma...> wrote: > >>>>> On Thu, 3 Apr 2003 09:46:41 -0500, Gerry Finkel > ><ga...@cs...> said: > > GF> All, > GF> [..snip..] > > GF> I have a base class called TestCase. Extended from that is a class > GF> for a specific page/servlet that I'm interacting with. I seem to > GF> be corrupting some data (specifically my URL) after several > GF> gets/posts are sent to the servlet. > > GF> Below is several chunks of code which I hope will explain what I'm > GF> doing. There's a comment in the leftmost column where I see the > GF> problem. Each of my classes have genFunc() methods for generating > GF> arrays of URLs which generate the queries I need. I do things like > > GF> my $numlist = Csf::ListMgmt->new(); > GF> $webtest->run_tests($numlist->genGetWholeList($listid)); > > GF> to generate my test runs. > > GF> I guess my main question is, is it safe to reference $self inside > GF> on_request? And can I say things like $self->anotherMethod() > GF> inside on_request? Is this just a bad thing to do? > > There is nothing wrong with it. You have a closure and unless Perl has > a bug it should work just as you expect it to work: i.e when > HTTP::WebTest calls it you get your Csf::ListMgmt object inside of > your on_request handler and you should be able to call its methods. > > Can you elaborate 'I seem to be corrupting some data ...' please? Do > you mean that HTTP::WebTest's objects change unexpectedly or do you > mean that Csf::ListMgmt object changes unexpectedly? > > BTW it is hard to tell for sure without seeing all code but should not > be it easier to rewrite your testing code as a plugin instead of using > on_request hooks? > > GF> [..snip..] > > -- > Ilya Martynov, il...@ip... > CTO IPonWEB (UK) Ltd > Quality Perl Programming and Unix Support > UK managed @ offshore prices - http://www.iponweb.net > Personal website - http://martynov.org > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ValueWeb: > Dedicated Hosting for just $79/mo with 500 GB of bandwidth! > No other company gives more support or power for your dedicated server > http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/ > _______________________________________________ > Http-webtest-general mailing list > Htt...@li... > https://lists.sourceforge.net/lists/listinfo/http-webtest-general -- Gerry Finkel phone (732)302-0222 ext. 6614 ga...@cs... fax (732)302-0799 MQSS pager (800) 759-8888 pin 1909963 As often happens, once we had a few songs finished that we liked, the newer ones started to get weirder. Daring grows out of confidence (or what the ancient Greeks called "hubris," I guess). Neil Peart |
|
From: Ilya M. <il...@ma...> - 2003-04-03 20:08:24
|
>>>>> On Thu, 3 Apr 2003 09:46:41 -0500, Gerry Finkel <ga...@cs...> said: GF> All, GF> [..snip..] GF> I have a base class called TestCase. Extended from that is a class for a GF> specific page/servlet that I'm interacting with. I seem to be corrupting GF> some data (specifically my URL) after several gets/posts are sent to the GF> servlet. GF> Below is several chunks of code which I hope will explain what I'm GF> doing. There's a comment in the leftmost column where I see the problem. GF> Each of my classes have genFunc() methods for generating arrays of URLs GF> which generate the queries I need. I do things like GF> my $numlist = Csf::ListMgmt->new(); GF> $webtest->run_tests($numlist->genGetWholeList($listid)); GF> to generate my test runs. GF> I guess my main question is, is it safe to reference $self inside GF> on_request? And can I say things like $self->anotherMethod() inside GF> on_request? Is this just a bad thing to do? There is nothing wrong with it. You have a closure and unless Perl has a bug it should work just as you expect it to work: i.e when HTTP::WebTest calls it you get your Csf::ListMgmt object inside of your on_request handler and you should be able to call its methods. Can you elaborate 'I seem to be corrupting some data ...' please? Do you mean that HTTP::WebTest's objects change unexpectedly or do you mean that Csf::ListMgmt object changes unexpectedly? BTW it is hard to tell for sure without seeing all code but should not be it easier to rewrite your testing code as a plugin instead of using on_request hooks? GF> [..snip..] -- Ilya Martynov, il...@ip... CTO IPonWEB (UK) Ltd Quality Perl Programming and Unix Support UK managed @ offshore prices - http://www.iponweb.net Personal website - http://martynov.org |
|
From: Gerry F. <ga...@cs...> - 2003-04-03 14:47:07
|
All,
I'm writing perl code (vs wt scripts) for my tests. I'm trying to build
a series of perl objects to allow cleaner development, but now I'm
starting to question how this really works. I'm hoping someone can tell
me if this is a bad idea.
I have a base class called TestCase. Extended from that is a class for a
specific page/servlet that I'm interacting with. I seem to be corrupting
some data (specifically my URL) after several gets/posts are sent to the
servlet.
Below is several chunks of code which I hope will explain what I'm
doing. There's a comment in the leftmost column where I see the problem.
Each of my classes have genFunc() methods for generating arrays of URLs
which generate the queries I need. I do things like
my $numlist = Csf::ListMgmt->new();
$webtest->run_tests($numlist->genGetWholeList($listid));
to generate my test runs.
I guess my main question is, is it safe to reference $self inside
on_request? And can I say things like $self->anotherMethod() inside
on_request? Is this just a bad thing to do?
Hope it's clear from my example what I'm doing.
Gerry
package Csf::ListMgmt;
use strict;
sub genGetWholeList {
my $self = shift;
my $listid = shift;
return (
{
test_name => 'Number List Get Whole List',
method => 'get',
url => $self->{baseUrl} . 'path',
params => {
obj => sub { $self->{artData}->{screenObj} },
op => 'whole',
opval => $listid
},
text_require => [
'<title>Number List Administration</title>',
'<textarea rows="10" name="numbers"',
'<input type="checkbox" name="saveList"',
],
text_forbid => [
],
on_response => sub {
my $webtest = shift;
my @results = ();
push(@results, $self->checkForErrors($webtest));
my @list = $self->getNumbersForList($webtest);
# It's at this point that my URL seems to be corrupt.
$self->{artData}->{numbersInList} = \@list;
# This piece of code puts all numbers in this number
# list into the results for "USER DEFINED TESTS" in
# the report.
#
#foreach my $num (@list) {
# push(@results, 'yes', $num);
#}
push(@results, $self->showScreenObject());
return \@results;
},
--
Gerry Finkel phone (732)302-0222 ext. 6614
ga...@cs... fax (732)302-0799
MQSS pager (800) 759-8888 pin 1909963
As often happens, once we had a few songs finished that we liked,
the newer ones started to get weirder. Daring grows out of
confidence (or what the ancient Greeks called "hubris," I guess).
Neil Peart
|
|
From: Remo B. <fo...@we...> - 2003-04-02 18:28:09
|
On Tue, 01 Apr 2003 15:53:40 +0400 Ilya Martynov <il...@ip...> wrote: > >>>>> "GF" == Gerry Finkel <ga...@cs...> writes: [...] > To be evaluated it should be written as > > sessionID => "$SID" don't work ... unfortunately $SID is empty ??? ok, drop all *.wt files and make my testcases direct in the perlscript, than i have no problem ;))) [...] thx for your help ... cu -- RayMan <fo...@we...> |