MOBY::Client::MobyUnitTest - Create Unit Tests and test your service
use MOBY::Client::MobyUnitTest; my $x = MOBY::Client::MobyUnitTest->new; # set expected output $x->expected_output($control_xml); # test expected output with XML output my $success = $x->test_output_xml($test_file); print "XML matches!\n" if $success; # set xpath statement $x->xpath($some_xpath); # test xpath statement $success = $x->test_xpath($test_xml); print "xpath success!\n" if $success; # set regex statement $x->regex($some_regex); # test regex statement $success = $x->test_regex($test_xml); print "regex success!\n" if $success; # get XML differences if any my $differences = $x->get_xml_differences($test_xml);
This module is used for providing unit test case information for any particular service, as well as actually performing the tests on the service.
Edward Kawas (edward.kawas [at] gmail [dot] com)
constructs a new MobyUnitTest reference. parameters (all optional) include:
example_input
expected_output
regex
xpath
getter/setter - use to get/set the example input for the service that we are testing.
getter/setter - use to get/set the expected output for the service that we are testing given example_input.
getter/setter - use to get/set the regular expression that will be applied agaisnt the actual output for the service that we are testing.
getter/setter - use to get/set the xpath expression that will be applied against the actual output for the service that we are testing.
subroutine that determines whether or not the passed in output XML is semantically similar to expected_output.
parameters - a scalar string of XML (or a file location) to test expected_output against.
a true value is returned if both XML docs are semantically similar, otherwise undef is returned.
subroutine that applies regex to the passed in output XML.
parameters - a scalar string of XML to test against.
a true value is returned if the regular expression matches, otherwise undef is returned.
subroutine that applies xpath to the passed in output XML.
parameters - a scalar string of XML (or a file location) to test against.
a true value is returned if the xpath statement matches 1 or more nodes in the XML, otherwise undef is returned.
subroutine that retrieves any differences found when comparing expected_output XML and the XML passed in to this sub.
parameters - a scalar string of XML to test expected_output against.
an array ref of strings representing the differences found between xml docs is returned.
1 POD Error
The following errors were encountered while parsing the POD:
=cut found outside a pod block. Skipping to next block.
To install MOBY, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MOBY
CPAN shell
perl -MCPAN -e shell install MOBY
For more information on module installation, please visit the detailed CPAN module installation guide.