Re: [Http-webtest-general] Questions from a beginner
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <il...@ip...> - 2003-03-19 16:06:36
|
>>>>> "LE" == Li, Eddie <Edd...@bg...> writes: LE> Thanks a lot for your reply, Ilya. LE> I'm just wondering if there is a way to save the return page of a LE> "wt" test, so that I can write a script to parse the saved return LE> page and then run more wt tests accordingly. If you use Perl API instead of just running wtscript with wt program you can use 'output_ref' and/or 'fh_out' parameters: use HTTP::WebTest; my $output = ''; my $webtest = HTTP::WebTest->new; $webtest->run_wtscript('script.wt', { output_ref => \$output }); In this case all output will be "redirected" into scalar variable $output. On the other hand I would not parse test output. It is easier to use Perl API to find results of tests. $webtest->tests->[$num]->results returns test results for test #$num. See perldoc HTTP::WebTest::API and HTTP::WebTest::Test for details. Another option (if you just want to add more checks for each test) is either using test parameter on_response from HTTP::WebTest::Plugin::Hooks plugin (see examples in HTTP::WebTest::Cookbook) or even writtin a plugin. Writting new plugin is not hard - see perldoc HTTP::WebTest::Plugins and sources of existing plugins. -- 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 |