http-webtest-general Mailing List for HTTP-WebTest (Page 11)
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: <u.b...@gm...> - 2003-01-28 16:14:08
|
Hi, is there an elegant solution for controlling the test flow within a wtscript? Is it possible to skip testcases or explicitely to define the successor testcase? I want to run dynamic tests whereby the sequence of testcases may vary depending on a response. in a wtscript there are 6 tests listed: A, B, C, D, E, F in general these tests run in this sequence is it possible to define a test flow like A, B, C (if X then D else E, F) X may be computed in a on_response hook if this is not possible (yet) I would try to implement theses tests splitting the flow into three scripts ((A,B,C), (D), (E,F)) and managing the flow in the calling perl script... just another (related) question: <example_code> $webtest->run_wtscript('case1'); my $content = $webtest->current_response->content; my ( $Next_Start_URL ) = $content =~ /action='(.+?)'/; if ( $content =~ /something/ ) { $webtest->run_wtscript('case2.1'); } else { $webtest->run_wtscript('case2.2'); } </example_code> is there a possibility to make the $Next_Start_URL available in the lateron called wtscripts case2.1 or case2.2? sorry if the answers to my questions are obvious, HTTP::WebTest is new for me. Thanks for any help, Udo -- +++ GMX - Mail, Messaging & more http://www.gmx.net +++ NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen! |
From: <il...@ma...> - 2003-01-22 16:14:42
|
>>>>> "KB" == Kevin Baker <ke...@ri...> writes: KB> No problem, this is not the end of the world. KB> I only sub'd it here in case no one was watching KB> the cpan rt. I receive emails when someone postes a bug/wish for HTTP-WebTest. Don't worry, it will not be missed :) It just that I react slowly sometimes. -- 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: Kevin B. <ke...@ri...> - 2003-01-22 16:08:33
|
No problem, this is not the end of the world. I only sub'd it here in case no one was watching the cpan rt. * il...@ma... <il...@ma...> [2003-01-22 15:25:21 +0300]: > >>>>> "KB" == Kevin Baker <ke...@ri...> writes: > > KB> Hi, I submitted this to cpan Request Tracker first... > KB> is it possible to make Click::click_link more adaptable? > > Hi Kevin, > > I've seen your post to Request Tracker. I'm sorry, I don't have time > to comment on it right now but I'll answer on it a bit later today. > > -- > 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 -- Kevin Baker RIPE NCC |
From: <il...@ma...> - 2003-01-22 12:22:31
|
>>>>> "KB" == Kevin Baker <ke...@ri...> writes: KB> Hi, I submitted this to cpan Request Tracker first... KB> is it possible to make Click::click_link more adaptable? Hi Kevin, I've seen your post to Request Tracker. I'm sorry, I don't have time to comment on it right now but I'll answer on it a bit later today. -- 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: Kevin B. <ke...@ri...> - 2003-01-21 21:51:35
|
Hi, I submitted this to cpan Request Tracker first... is it possible to make Click::click_link more adaptable? My issue is that I may have many <a> links on the web page returned by a test with the same <a href="...">Text</a>. The only way they differ is the contents of the href attribute of the a tag. Would it be possible to tell 'click_link' to click on the <a> tag via the href text instead of the 'Text'? For instance, I have many links on a list that look like this <a href"/edit_user.html?user=adam">Edit</a> <a href"/edit_user.html?user=john">Edit</a> <a href"/edit_user.html?user=pete">Edit</a> It'd be nice to say... click_link => { href => 'edit_user.html?user=pete' } or some wonderful syntax that differentiates from the usual way you guys built it. The other thing is that in Click::find_link, it checks the pattern case insensitively. Is it important to do this? I noticed that because I had a href link with the text, 'Back', and another mailto link with the mail address '<feedback@x.com>'. The pattern matched on the mail address first. If it had been case sensitive I wouldn't have noticed. Perhaps you can either turn this behaviour on or off or document it or let the person pass their own regex in? thanks for your efforts, much appreciated Kev -- Kevin Baker RIPE NCC |
From: Eral T. <era...@ho...> - 2003-01-21 16:34:55
|
>From: Johannes la Poutre <joe...@us...> > >Eral, > >Check your spelling of the wt-script parameter name: >it is "text_require", you made this plural ("text_requires"), which is >plainly ignored. > >So this should work OK: > Duh! Shame on me :( I knew that was a dumb question. Thank you very much Johannes, it works fine now. =o= eral _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus |
From: William M. <wi...@kn...> - 2003-01-21 15:14:29
|
On Mon, Jan 20, 2003 at 06:57:06PM -0800, Eral TRMB wrote: > I am just trying this module for the first time, so I apologize in advance > if my question is dumb. I cannot understand how text_requires works. I > would expect a unsuccessful attempt to find the given argument would make > the test fail, but if I test it with: Well, there is no 'text_requires' test, it's 'text_require'. I think what is happening is that WebTest is skipping the unknown test and just checking that the page can be retrieved. I guess that is the default test performed whenever you assign a test. Try renaming the test and see if that adds an extra test. Hope that helps, William -- Knowmad Services Inc. http://www.knowmad.com |
From: Johannes la P. <joe...@us...> - 2003-01-21 10:32:43
|
Eral, Check your spelling of the wt-script parameter name: it is "text_require", you made this plural ("text_requires"), which is plainly ignored. So this should work OK: ===== test_name = Test WebTest url = http://a.valid.url/ text_require = ( AMissingWord ) end_test ===== Take care, Joe. |
From: Eral T. <era...@ho...> - 2003-01-21 03:01:06
|
Hi, I am just trying this module for the first time, so I apologize in advance if my question is dumb. I cannot understand how text_requires works. I would expect a unsuccessful attempt to find the given argument would make the test fail, but if I test it with: test_name = Test WebTest url = http://a.valid.url/ text_requires = ( AMissingWord ) end_test The results are always: $ wt testwebtest.t Failed Succeeded Test Name 0 1 Test WebTest Test Name: Test WebTest URL: http://a.valid.url STATUS CODE CHECK Expected '200' and got: 200 OK SUCCEED Total web tests failed: 0 succeeded: 1 Is there anything I am doing wrong? Thank you. =o= eral _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |
From: Johannes la P. <joe...@us...> - 2003-01-07 09:31:54
|
On Mon, 6 Jan 2003, Jagannadh Pariti wrote: > > Hello. I was wondering if there was any way to simulate the "Back" > button on the browser using WebTest? > Any advice would be helpful. Jag, There seems to be some misunderstanding about what http-webtest can test and what it can not. The sole purpose of this test framework is to monitor the behaviour of http webservers and applications that are accessible throug http (like PHP, CGI, Servlets and such). Hence the name "HTTP-WebTest". Now what you are looking for has more to do with http client behaviour (the web browser). What happens when a user clicks the "back button"? This largely depends on: 1. caching headers sent with the original http document (the web page) 2. browser settings (Always compare with server /sometimes /never compare). 3. intermediate proxy behaviour (inspection of query and headers) The first item *can* be tested by HTTP-WebTest (you have to look for specific headers like last modified timestamp and caching headers), other items are of course beyond the purpose of the framework. However, as you can even construct the headers which WebTest sends with the page request, you could as well generate a "if-modified-since: <timestamp>" header on the fly and see what happens. The conclusion has to be that you can accurately monitor what the web document the server is returning to you depending on lots of conditions, but you can not mimic the behaviour of user agents AKA "browsers". HTH! Cheers, Joe. |
From: Jagannadh P. <jag...@ya...> - 2003-01-07 03:35:26
|
Hello. I was wondering if there was any way to simulate the "Back" button on the browser using WebTest? Any advice would be helpful. Thanks. Jag --------------------------------- Post your free ad now! Yahoo! Canada Personals |
From: Johannes la P. <joe...@us...> - 2003-01-06 09:41:40
|
Ilya, The floating point patch indeed fixes the make test error on my production platform. Thanks! > I think it is just a rounding error. Since response time vary in each > test run it should be rounded when it is compared with > t/test.out/timeout file. > [snip] |
From: Ilya M. <il...@ma...> - 2003-01-03 22:17:20
|
>>>>> On Fri, 03 Jan 2003 16:25:32 +0100, Johannes la Poutre <joe...@us...> said: JP> Ilya, JP> While running make test for HTTP::WebTest I got a failure for test JP> suite t/02-generic.t, subtest #35, JP> The failure is caused by a timeout that is expected to take 1 second JP> but in practice appears to be 0: JP> - 30 Response time ( 1.00 ) is < or = 10.00 ? JP> SUCCEED JP> + 30 Response time ( 0.00 ) is < or = 10.00 ? JP> SUCCEED JP> not ok 35 JP> # Failed test 35 in [...]/SelfTest.pm at line 340 fail #28 JP> FAILED test 35 JP> Failed 1/35 tests, 97.14% okay I think it is just a rounding error. Since response time vary in each test run it should be rounded when it is compared with t/test.out/timeout file. As it was implented response time 0.99 was rounded to 0.00 what breaks this test. Can you please try following patch: *** 02-generic.t.~1.24.~ Mon Dec 23 00:25:50 2002 --- 02-generic.t Sat Jan 4 01:03:13 2003 *************** *** 651,659 **** my $out_filter = sub { $_[0] =~ s|( Response \s+ time \s+ \( \s+ ) ! ( \d+ \. ) ( \d+ ) ( \s+ \) ) ! |"$1$2" . ('0' x length($3)) . "$4"|xge; }; check_webtest(webtest => $WEBTEST, --- 651,659 ---- my $out_filter = sub { $_[0] =~ s|( Response \s+ time \s+ \( \s+ ) ! ( \d+ \. \d+ ) ( \s+ \) ) ! |"$1" . sprintf('%.2f', int $2 + 0.25) . "$3"|xge; }; check_webtest(webtest => $WEBTEST, JP> [..snip..] JP> P.S. shouldn't we have the bug reporting feature on Sourceforge, or JP> rather use the one on rt.cpan.org? I prefer to use rt.cpan.org. It seems to be more "standart" place for bug reports for Perl modules. -- 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: Johannes la P. <joe...@us...> - 2003-01-03 15:25:46
|
Ilya, While running make test for HTTP::WebTest I got a failure for test suite t/02-generic.t, subtest #35, The failure is caused by a timeout that is expected to take 1 second but in practice appears to be 0: - 30 Response time ( 1.00 ) is < or = 10.00 ? SUCCEED + 30 Response time ( 0.00 ) is < or = 10.00 ? SUCCEED not ok 35 # Failed test 35 in [...]/SelfTest.pm at line 340 fail #28 FAILED test 35 Failed 1/35 tests, 97.14% okay I'm on a really fast IBM Linux server: Linux 2.4.17-ibm3042 #1 SMP Thu Jan 24 13:48:35 CET 2002 i686 unknown Perl version 5.005_03 locally built for i686-linux (we are "a little" behind on our production platforms) Not sure if this is really a timing issue, but to be sure I ran the test 3 more times, with the same result. As expected, all tests pass with TEST_FAST=1 Cheers, Joe. P.S. shouldn't we have the bug reporting feature on Sourceforge, or rather use the one on rt.cpan.org? |
From: Ilya M. <il...@ma...> - 2002-12-18 16:50:14
|
Crap, first spam post to this mailling list. Unless anybody objects I'm disabling non-member posting to the mailling list. Non-members will still be allowed to post but their messages will be held in the queue until moderator (me) approves or rejects them. -- 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: rakoci <cyb...@ya...> - 2002-12-18 16:11:41
|
WOULD YOU LIKE TO HAVE YOUR MESSAGE SEEN BY OVER 15.1 MILLION TARGETED PROSPECTS DAILY? Below contains all the information you will ever need to market your product or service on the Internet. If you have a product, service, or message that you would like to get out to Thousands, Hundreds of Thousands, or even Millions of people, you have several options. Traditional methods include print advertising, direct mail, radio, and television advertising. They are all effective, but they all have two catches: They're EXPENSIVE and TIME CONSUMING. Not only that, you only get ONE SHOT at making your message heard by the right people. Also, Internet Search Engine Submissions, Classified Ads, Newsgroup Postings simply DO NOT WORK effectively. Now this has all changed! Thanks to the top programmers in the world and their NEW EMAIL TECHNOLOGY, You can send millions of email messages daily for FREE...Without getting terminated from your current Internet connection! It's very simple to do and you can be increasing your sales within minutes of installing this new extraordinary software! Besides...It's the only real way to advertise on the Internet that works...Period! >>>WE WILL SUPPLY YOU WITH OVER 15.1 MILLION OPT-IN EMAIL ADDRESSES TO GET YOU STARTED RIGHT AWAY! >>>PLUS FREE EMAIL ADDRESS DOWNLOADS FOR LIFE! >>>ALSO, YOU WILL RECEIVE $2,000 WORTH OF EMAIL MARKETING SOFTWARE FREE! Including...... BROADCAST EMAIL SENDING SOFTWARE...(send millions of email advertisements daily with a few clicks of your mouse, without getting your ISP trerminated. We used the same software to send you this email) EMAIL EXTRACTION SOFTWARE...(retrieve new targeted email addresses daily. Hundreds of thousands of them) LIST MANAGEMENT SOFTWARE...(keep your lists clean, opt-in and manage all your remove requests, leads, sales etc...) and much...much more! Hurry...This extraordinary offer ends soon! To find out more information, Do not respond by email. Instead, click on the link below or copy and paste the exact web site address below into your web browser. http://www.tristarzeus.com/504305/addresses.htm ______________________________________________________ Want to be removed from our email list? You were sent this email because you used our Opt-in service. We hope you enjoy reading our messages. However, if you'd rather not receive future e-mails from us, Go to our remove page at http://www.tristarzeus.com/504305/remove.htm ______________________________________________________ |
From: Ilya M. <il...@ma...> - 2002-12-16 22:22:48
|
The URL http://martynov.org/tgz/HTTP-WebTest-Plugin-Apache-1.01.tar.gz has entered CPAN as file: $CPAN/authors/id/I/IL/ILYAM/HTTP-WebTest-Plugin-Apache-1.01.tar.gz size: 26256 bytes md5: e12ba3c97638508b881da180d7cae49e NAME HTTP::WebTest::Plugin::Apache - Plugin for local web file tests DESCRIPTION This plugin adds support for local web file test mode to HTTP::WebTest. In this mode Apache is started on a private/dynamic port with a configuration file in a temporary directory and HTTP::WebTest runs its tests against local web files using this temporary local instance of Apache. Changes since 1.00: BUG FIXES: * Fix bug in test suite which is triggered when 'make test' is run non-interactively. -- 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...@ma...> - 2002-12-14 20:32:41
|
The URL http://martynov.org/tgz/HTTP-WebTest-Plugin-Apache-1.00.tar.gz has entered CPAN as file: $CPAN/authors/id/I/IL/ILYAM/HTTP-WebTest-Plugin-Apache-1.00.tar.gz size: 26188 bytes md5: 71b2e5150873d975e32c4a3cf36b80b4 NAME HTTP::WebTest::Plugin::Apache - Plugin for local web file tests DESCRIPTION This plugin adds support for local web file test mode to HTTP::WebTest. In this mode Apache is started on a private/dynamic port with a configuration file in a temporary directory and HTTP::WebTest runs its tests against local web files using this temporary local instance of Apache. -- 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...@ma...> - 2002-12-14 18:31:48
|
The URL http://martynov.org/tgz/HTTP-WebTest-2.00.tar.gz has entered CPAN as file: $CPAN/authors/id/I/IL/ILYAM/HTTP-WebTest-2.00.tar.gz size: 85858 bytes md5: e93464263f7cd321c8b43fa7c73604e0 NAME HTTP::WebTest - Testing static and dynamic web content DESCRIPTION This module runs tests on remote URLs containing Perl/JSP/HTML/JavaScript/etc. and generates a detailed test report. This module can be used "as-is" or its functionality can be extended using plugins. Plugins can define test types and provide additional report capabilities. This module comes with a set of default plugins but can be easily extended with third party plugins. MAJOR CHANGES SINCE LAST STABLE VERSION 1.07: * This is full rewrite which features modular easily expendable architecture: new test types can be added with plugin modules. * Support for Test::Harness style testing have been added. * Many new standart test types have been added. * Support for local file test mode have been removed from this version and will be implemented in plugin which will be released separately. * Licensing terms have been changed from Artistic only and now HTTP-WebTest is dual licensed under Artistic/GPL. * Many other changes I forgot to mention :) CHANGES SINCE LAST BETA VERSION 1.99_09: ENHANCEMENTS: * Allow plugins to insert tests into the test queue during test sequence runtime. Inspired by Paul Hamingson's patch. * New core test parameter 'relative_urls' which enables HTTP-WebTest to use relative URLs in tests. * New core test parameter 'timeout' which allows to control user agent timeout settings while running test sequence. * Moved self-test suite support code into module HTTP::WebTest::SelfTest to allow reusing it in self-test suites for plugins maintained outside of HTTP-WebTest. INCOMPATIBILITIES: * HTTP::WebTest::Plugin::Apache plugin have been removed from HTTP::WebTest and will be released as independent CPAN module. It will no longer be loaded by default even if it is available. * Renamed all last_xxx methods to current_xxx since the latest naming schema is less confusing. * HTTP::WebTest::Plugin::HarnessReport is rewritten using Test::Builder. As side effect now you can freely intermix HTTP::WebTest based tests with tests written using other testing libraries like Test::More or Test::Differences. Unfortunately this change breaks existing test scripts which were using HTTP::WebTest::Plugin::HarnessReport because now number of tests in test scripts should be declared explictly with 'use Test::More plan => NN' or 'use Test::More qw(no_plan)'. BUG FIXES: * Fixed some minor documentation bugs. Thanks to William McKee. * Allow to use $webtest->last_xxx method calls after running test sequence with $webtest->run_tests. Thanks to Kevin Baker for patch. -- 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...@ma...> - 2002-11-06 14:05:23
|
>>>>> On Tue, 5 Nov 2002 18:19:34 +0100, Kevin Baker <ke...@ri...> said: >> Anyway I've applied your patch and your code is in CVS >> repository. Thanks you again for the patch. KB> Looking into this a little further, I notice that KB> my patch may not be so well thought out. In that patch KB> I added the set last_test inside the loop (around line 130) KB> in HTTP::WebTest::API and removed the line at 133 that KB> was setting last_test to undef. I think now that KB> the it is not necessary to add the KB> $self->last_test($test); KB> inside the testing loop since I notice that it is set KB> in run_test at line 534. Well, your patch went into CVS only partially :) Sorry, I forgot to tell you. I've only removed that line and added test to asure that last_xxx methods work when tests are finished. KB> [..snip..] KB> I've got a workaround by using the on_response hooks. KB> I capture the location in the last test and set a var KB> that I use in the next test. KB> my $referral; KB> run_tests([ KB> { KB> url => 'mysite.com', KB> status_code => 302, KB> handle_redirects => 'no', KB> on_response => sub { KB> my $wt = shift; KB> $referral = $wt->last_response->headers->{'location'}; KB> []; KB> } KB> }, KB> { KB> url => sub { $referral }, KB> }, You could implement it without using on_response hook. Something like { url => sub { my $wt = shift; $wt->tests[$wt->last_test_num - 1]->response->headers->{'location'}; } } KB> The method names are a little confusing though (for me). KB> If I'm looking at the response in on_response I'd KB> expect the method to be called 'response'. 'last_response' KB> makes me think that it is referring to the last test's KB> response. ;-) I tend to agree with you. The thing is that these names are result of HTTP::WebTest code evolution. At the beginning these names made more sense. I probably will rename all last_xxx methods to current_xxx methods and add last_xxx methods that "do right thing". -- 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...@ma...> - 2002-11-06 13:47:14
|
>>>>> On Tue, 05 Nov 2002 16:23:28 +0100, Johannes la Poutre <joe...@us...> said: JP> Jag, Ilya, JP> On Perlmonks.org there is currenlty a thread about exactly this JP> subject (sheer coincidence I guess). JP> The title: "LWP || HTML:: Request and Javascripts JP> <http://perlmonks.org/index.pl?node_id=210444>", URL: JP> <http://perlmonks.org/index.pl?node_id=210444> JP> Maybe this can be of further help... BTW am I right that your perlmonk's username is joe++? -- 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...@ma...> - 2002-11-06 13:43:21
|
>>>>> On Mon, 4 Nov 2002 18:48:31 -0500 (EST), Jagannadh Pariti <jagpariti@= yahoo.ca> said: JP> Hi Ilya. I have been posting a couple of messages about WebTest JP> and JavaScript. Joe has been kind enough to answer my question, JP> but I did want to verify=A0with you as well. My question is below in JP> Message1. I want to be able to=A0simulate the alert boxes without JP> opening up a browser. Is there a way to do that? Frankly I don't have anothing to add to Joe's words. HTTP-WebTest works on HTTP protocol level and cannot test client side programing (i.e. JavaScript). If you want to test Javascript you probably need GUI testing tools. --=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: Kevin B. <ke...@ri...> - 2002-11-05 17:19:46
|
Hi * Ilya Martynov <il...@ma...> [2002-11-04 20:50:58 +0300]: > > KB> [..snip..] > > KB> Unless you can see an easier way to accomplish this. > > Sure :) > > Untested code: > > [..snip..] works out great. it's looking much cleaner. thanks. > Anyway I've applied your patch and your code is in CVS > repository. Thanks you again for the patch. Looking into this a little further, I notice that my patch may not be so well thought out. In that patch I added the set last_test inside the loop (around line 130) in HTTP::WebTest::API and removed the line at 133 that was setting last_test to undef. I think now that the it is not necessary to add the $self->last_test($test); inside the testing loop since I notice that it is set in run_test at line 534. I noticed this since I was trying to access the $webtest->last_response inside a test to set the url based on the referral from the previous test. Roughly something like this run_tests([ { url => 'mysite.com', status_code => 302, handle_redirects => 'no', }, { url => sub { my $wt = shift; return $wt->last_response->headers->{'location'}; } }, However it seems that since last_test is set before the plugins are prepared at (at line 547) the plugin is not accessing the last_test, but rather the current one. (I'm guessing that $plugin->prepare_request is where the url parm gets processed. I haven't actually checked) My question is, is there any reason why you can't set last_test after you've processed the current test? I can see that you are using last_test in the subs that set all the last_request/last_response etc, so you could move the setting of these to the end of the run_test routine, after setting last_test. I've got a workaround by using the on_response hooks. I capture the location in the last test and set a var that I use in the next test. my $referral; run_tests([ { url => 'mysite.com', status_code => 302, handle_redirects => 'no', on_response => sub { my $wt = shift; $referral = $wt->last_response->headers->{'location'}; []; } }, { url => sub { $referral }, }, The method names are a little confusing though (for me). If I'm looking at the response in on_response I'd expect the method to be called 'response'. 'last_response' makes me think that it is referring to the last test's response. ;-) Food for thought thanks Kev |
From: Johannes la P. <joe...@us...> - 2002-11-05 15:23:39
|
Jag, Ilya, On Perlmonks.org there is currenlty a thread about exactly this subject (sheer coincidence I guess). The title: "LWP || HTML:: Request and Javascripts <http://perlmonks.org/index.pl?node_id=210444>", URL: <http://perlmonks.org/index.pl?node_id=210444> Maybe this can be of further help... Cheers, Joe. |
From: Jagannadh P. <jag...@ya...> - 2002-11-04 23:48:36
|
Hi Ilya. I have been posting a couple of messages about WebTest and JavaScript. Joe has been kind enough to answer my question, but I did want to verify with you as well. My question is below in Message1. I want to be able to simulate the alert boxes without opening up a browser. Is there a way to do that? Thanks. Jag Today's Topics: 1. WebTest and JavaScript (Jagannadh Pariti) 2. Re: WebTest and JavaScript (Johannes la Poutre) --__--__-- Message: 1 Date: Wed, 30 Oct 2002 11:05:39 -0500 (EST) From: Jagannadh Pariti To: htt...@li... Subject: [Http-webtest-general] WebTest and JavaScript --0-1582144184-1035993939=:7195 Content-Type: text/plain; charset=us-ascii I figure in my previous postings that I should have been more clear with my question.The web page I want to test includes JavaScript for some fields. If those particular fields do not have a value in them, an alert box comes up, after pressing a Submit button. I want to be able to generate those alert boxes. Is there anyway to do that? --------------------------------- Post your free ad now! Yahoo! Canada Personals --0-1582144184-1035993939=:7195 Content-Type: text/html; charset=us-ascii I figure in my previous postings that I should have been more clear with my question.The web page I want to test includes JavaScript for some fields. If those particular fields do not have a value in them, an alert box comes up, after pressing a Submit button. I want to be able to generate those alert boxes. Is there anyway to do that? --------------------------------- Post your free ad now! Yahoo! Canada Personals --0-1582144184-1035993939=:7195-- --__--__-- Message: 2 Date: Wed, 30 Oct 2002 17:53:44 +0100 From: Johannes la Poutre To: Jagannadh Pariti CC: htt...@li... Subject: Re: [Http-webtest-general] WebTest and JavaScript Jagannadh, > I figure in my previous postings that I should have been more clear with my > question.The web page I want to test includes JavaScript for some fields. If those > particular fields do not have a value in them, an alert box comes up, after pressing a > Submit button. I want to be able to generate those alert boxes. Is there anyway to do > that? If I understand you correctly, you want to use HTTP::WebTest to mimic a graphical user agent (that is, a web browser) with all of its behaviour. That means that you acttually have to parse the results as a browser would do, including JavaScript. This is not what WebTest does. The webtest modules can only act on a retrieved document from the web (which can be anything) and perform lots of sanity tests on that content. This means that you can perfectly monitor expected behaviour of a known website. Example: WebTest requests a URL, like http://my.site/start.html WebTest inspects the result (e.g. looks for a terminating tag) WebTest generates a report (there are a lot of more elaborate examples in the documentation - recommended!). However, this has nothing to do with the fact whether this content renders properly on a standard web browser. In other words, WebTest is not a QA tool for acceptance tests , just a generic and versatile monitoring tool to see if an existing situation doesn't change in an unexpected way. If you want to test your (cgi-) form application for certain responses, nearly everything is possible with WebTest (just send a malformed request and check for the expected error message). If that means that this response contains specific JavaScript code (like a custom error message) you can just check for this. On the other hand, if you want to display popups, generated from a web browser by means of JavaScript, you should use your web browser. At least, that's what I think... Cheers, Joe. --__--__-- _______________________________________________ Http-webtest-general mailing list Htt...@li... https://lists.sourceforge.net/lists/listinfo/http-webtest-general End of Http-webtest-general Digest --------------------------------- Post your free ad now! Yahoo! Canada Personals |