HTML::Testing - Test module to make test files simpler.
A test file, simple.t may be created as follows:
print "1..1\n"; use strict; require HTML::FormatNroff; use HTML::Parse; require HTML::Testing; my $man_date = '20 Dec 97'; my $name = "simple"; my $html_source =<<END_INPUT; <HTML> <BODY>This is the body.</BODY> </HTML> END_INPUT my $expected = ".TH \"$name\" \"1\" \"$man_date\" \"FormatNroff\" \n"; $expected .=<<END_EXPECTED; .PP This is the body. END_EXPECTED my $tester = new HTML::Testing(name => $name, man_date => $man_date, project => 'FormatNroff', man_header => 1, expected => $expected, html_source => $html_source output => 'TestOutput', ); $tester->run_test(); 1;
Running the test harness with this will result in the creation of the files simple_expected.out, simple_actual.out and an html file corresponding to the html_source (simple.html). In addition, the test will return 'ok' if they are the same, and 'not ok' if not.
If the attribute html_file is specified, then html will be sourced from that file instead of html_source, and no html file will be created.
Create new test.
Set the directory for output (HTML, actual and expected output files) to $value.
Run the test.
Copyright (c) 1997 Frederick Hirsch. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Frederick Hirsch <f.hirsch@opengroup.org>
To install HTML::Testing, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Testing
CPAN shell
perl -MCPAN -e shell install HTML::Testing
For more information on module installation, please visit the detailed CPAN module installation guide.