Update of /cvsroot/http-webtest/HTTP-WebTest-Plugin-XPath/lib/HTTP/WebTest/Plugin
In directory sc8-pr-cvs1:/tmp/cvs-serv13315/lib/HTTP/WebTest/Plugin
Modified Files:
XPath.pm
Log Message:
Implementation for xpath_ok and xpath_nok
Index: XPath.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest-Plugin-XPath/lib/HTTP/WebTest/Plugin/XPath.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** XPath.pm 13 Feb 2003 07:14:12 -0000 1.1.1.1
--- XPath.pm 13 Feb 2003 21:41:11 -0000 1.2
***************
*** 21,28 ****
use strict;
- use HTTP::WebTest::Utils qw(make_access_method);
-
use base qw(HTTP::WebTest::Plugin);
=head1 TEST PARAMETERS
--- 21,29 ----
use strict;
use base qw(HTTP::WebTest::Plugin);
+ use HTTP::WebTest::Utils qw(make_access_method);
+ use XML::LibXML;
+
=head1 TEST PARAMETERS
***************
*** 32,37 ****
sub param_types {
! return q();
}
=head1 SUPPORT
--- 33,75 ----
sub param_types {
! return q(xpath_ok list
! xpath_nok list);
! }
!
! # accessor method for XML::LibXML object
! *libxml = make_access_method('LIBXML', sub { XML::LibXML->new });
!
! sub check_response {
! my $self = shift;
!
! $self->validate_params(qw(xpath_ok xpath_nok));
!
! # parse document
! my $content = $self->webtest->current_response->content;
! my $doc = $self->libxml->parse_html_string($content);
!
! # test results
! my @results = ();
! my @ret = ();
!
! for my $xpath (@{$self->test_param('xpath_nok', [])}) {
! push(@results,
! $self->test_result(! $doc->find($xpath)->to_boolean, $xpath));
! }
!
! push @ret, ['False XPath expression', @results] if @results;
!
! @results = ();
!
! for my $xpath (@{$self->test_param('xpath_ok', [])}) {
! push(@results,
! $self->test_result($doc->find($xpath)->to_boolean, $xpath));
! }
!
! push @ret, ['True XPath expression', @results] if @results;
!
! return @ret;
}
+
=head1 SUPPORT
|