So, what's the best way to check output? Do you decided absolutely what the output will look like at the beginning of the project and hardcode it into a test? Do you just ignore testing output, and look at the output after every change? Do you do something completely different?
Some suggestions:
- Put as little presentational markup in the HTML as possible, relying on CSS for look and feel. This makes the underlying HTML far less likely to change.
- Test for well formed HTML, since that catches lots of typos.
- To get something quick and dirty up and running use a regex test, e.g. like( $obj->output, qr/relevant info/i ).
In general I try and make output layers as thin as possible, do as little as possible, and have as little knowledge about what they're presenting as possible. For example rather than having:
my $o = FribbleList::HTML->new;
$o->output;
I'd tend to have something like
my $html_list_output = ListOutput::HTML->new;
my $o = FribbleList->new( output => $html_list_output );
$o->output; # really does $html_list_output->output( $o->list );
so I can test my FribbleList class completely independently of my ListOutput::HTML class.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.