[Http-webtest-commits] HTTP-WebTest-Recorder/t 06-action-wtscript.t,NONE,1.1
Brought to you by:
m_ilya,
richardanderson
From: Ilya M. <m_...@us...> - 2003-01-07 21:04:11
|
Update of /cvsroot/http-webtest/HTTP-WebTest-Recorder/t In directory sc8-pr-cvs1:/tmp/cvs-serv3779/t Added Files: 06-action-wtscript.t Log Message: Added --- NEW FILE: 06-action-wtscript.t --- #!/usr/bin/perl -w use strict; use HTTP::Request::Common; use HTTP::Status; use HTTP::WebTest::Test; use Test::More tests => 7; require_ok('HTTP::WebTest::Action::WTScript'); require_ok('HTTP::WebTest::Controller'); require_ok('HTTP::WebTest::Recorder'); # test constructors my $ACTION = new HTTP::WebTest::Action::WTScript; isa_ok($ACTION, 'HTTP::WebTest::Action::WTScript'); my $CONTROLLER = new HTTP::WebTest::Controller; isa_ok($CONTROLLER, 'HTTP::WebTest::Controller'); my $RECORDER = new HTTP::WebTest::Recorder; isa_ok($RECORDER, 'HTTP::WebTest::Recorder'); $CONTROLLER->recorder($RECORDER); # init recorder with some data { my $test1 = HTTP::WebTest::Test->new; $test1->request(GET 'http://example.com/doc1.html'); $test1->response(HTTP::Response->new(RC_OK)); $test1->response->content('DOC #1'); my $test2 = HTTP::WebTest::Test->new; $test2->request(POST 'http://example.com/doc2.html', [ xx => 'yy', 1 => 2]); $test2->response(HTTP::Response->new(RC_NOT_FOUND)); $test2->response->content('Not Found'); my $test3 = HTTP::WebTest::Test->new; $test3->request(GET 'http://example.com/doc3.html?a=b&a=c'); $test3->response(HTTP::Response->new(RC_OK)); $test3->response->content('DOC #2'); push @{$RECORDER->tests}, $test1, $test2, $test3; } # check if template_data returns draft of wtscript { my %data = $ACTION->template_data($CONTROLLER); is($data{wtscript}, <<'WTSCRIPT', test_name = N/A url = http://example.com/doc1.html end_test test_name = N/A url = http://example.com/doc2.html method = POST params = ( xx => yy 1 => 2 ) end_test test_name = N/A url = http://example.com/doc3.html params = ( a => b ) end_test WTSCRIPT 'Check if "wtscript" variable is defined'); } |