Test::XML::Simple - easy testing for XML
use Test::XML::Simple tests=>5; xml_valid $xml, "Is valid XML"; xml_node $xml, "/xpath/expression", "specified xpath node is present"; xml_is, $xml, '/xpath/expr', "expected value", "specified text present"; xml_like, $xml, '/xpath/expr', qr/expected/, "regex text present"; xml_is_deeply, $xml, '/xpath/expr', $xml2, "structure and contents match"; # Not yet implemented: # xml_like_deeply would be nice too...
Test::XML::Simple is a very basic class for testing XML. It uses the XPath syntax to locate nodes within the XML. You can also check all or part of the structure vs. an XML fragment.
Test::XML::Simple
Pass an XML file or fragment to this test; it succeeds if the XML (fragment) is valid.
Checks the supplied XML to see if the node described by the supplied XPath expression is present. Test fails if it is not present.
Finds the node corresponding to the supplied XPath expression and compares it to the supplied value. Succeeds if the two values match.
Find the XML corresponding to the the XPath expression and check it against the supplied regular expression. Succeeds if they match.
Find the piece of XML corresponding to the XPath expression, and compare its structure and contents to the second XML (fragment) supplied. Succeeds if they match in structure and content.
Joe McMahon, <mcmahon@cpan.org>
Copyright (c) 2005 by Yahoo!
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.1 or, at your option, any later version of Perl 5 you may have available.
XML::XPath, Test::More, Test::Builder.
To install Test::XML::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::XML::Simple
CPAN shell
perl -MCPAN -e shell install Test::XML::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.