Update of /cvsroot/http-webtest/HTTP-WebTest-Recorder/lib/HTTP/WebTest/Recorder/Action
In directory sc8-pr-cvs1:/tmp/cvs-serv635/lib/HTTP/WebTest/Recorder/Action
Modified Files:
WTScript.pm
Log Message:
Use HTTP::WebTest::Parser to create wtscript file
Index: WTScript.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest-Recorder/lib/HTTP/WebTest/Recorder/Action/WTScript.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** WTScript.pm 25 Jan 2003 14:54:52 -0000 1.1
--- WTScript.pm 25 Jan 2003 18:23:43 -0000 1.2
***************
*** 5,8 ****
--- 5,10 ----
use strict;
+ use HTTP::WebTest::Parser;
+
use base qw(HTTP::WebTest::Recorder::Action);
***************
*** 13,19 ****
my $controller = shift;
! my @tests = @{$controller->recorder->tests};
!
! my $wtscript = join "\n", map $self->test2wtscript($_), @tests;
return($self->SUPER::execute($controller),
--- 15,20 ----
my $controller = shift;
! my $wtscript = (join "\n", map $self->test2wtscript($_),
! @{$controller->recorder->tests});
return($self->SUPER::execute($controller),
***************
*** 25,58 ****
my $test = shift;
! my $request = $test->request;
!
! my $wtscript = '';
!
! $wtscript .= "test_name = N/A\n";
!
! my $short_uri = URI->new($request->uri);
! $short_uri->query(undef);
! $wtscript .= ' url = ' . $short_uri . "\n";
! $wtscript .= ' method = ' . $request->method . "\n"
! if $request->method ne 'GET';
!
! my $cgi;
! if($request->method eq 'POST') {
! $cgi = CGI->new($request->content);
! } else {
! $cgi = CGI->new($request->uri->query);
! }
! if($cgi->param) {
! $wtscript .= " params = (\n";
! for my $param ($cgi->param) {
! $wtscript .= ' ' .
! $param . ' => ' . $cgi->param($param) . "\n";
! }
! $wtscript .= " )\n";
! }
!
! $wtscript .= "end_test\n";
! return $wtscript;
}
--- 26,32 ----
my $test = shift;
! my @params = map +($_ => $test->params->{$_}), sort keys %{$test->params};
! return HTTP::WebTest::Parser->write_test(\@params);
}
|