Re: [Http-webtest-general] Questions from a beginner
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <il...@ip...> - 2003-03-19 17:38:37
|
>>>>> "LE" == Li, Eddie <Edd...@bg...> writes: LE> Thank, Ilya. LE> I guess that I didn't describe my last question clearly. I didn't mean LE> to save the output of a test. What I really want is the content that LE> WebTest gets from the website. I guess it is a pure HTML source code? LE> Since WebTest can check for the required text with 'text_require', I LE> guess it should be able to save the return content. LE> What I like to do is that I get the return content first, parse it, and LE> do more test. For example, I may run a simple test to www.yahoo.com and LE> get the webpage content, and then find all the links to images, and then LE> run a test for each image. All HTTP requests and HTTP responses (including content) are available via Perl API. For example to get content of HTTP response in the test #$num my $content = $webtest->tests->[$num]->response->content. If you want to get content of HTTP reposense for current test case in one of hooks provided by HTTP::WebTest::Plugin::Hooks plugin you can use shortcut. my $content = $webtest->current_response->content (see http://search.cpan.org/author/ILYAM/HTTP-WebTest-2.01/lib/HTTP/WebTest/Cookbook.pod#Dynamic_Tests for example) Same shortcut will work if you'll define your additional tests in your own plugin. -- 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 |