Frederick Hirsch


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;
 <BODY>This is the body.</BODY>

 my $expected = ".TH \"$name\" \"1\" \"$man_date\" \"FormatNroff\"  \n";  
 $expected .=<<END_EXPECTED;
 This is the body.

 my $tester = new HTML::Testing(name => $name,
                                man_date => $man_date,
                                project => 'FormatNroff',
                                man_header => 1,
                                expected => $expected,
                                html_source => $html_source
                                output => 'TestOutput',


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.

$testing = new HTML::Testing();

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 <>