Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Testing Template, or should I write a diff for TT templates?

by PodMaster (Abbot)
on Nov 14, 2003 at 19:11 UTC ( [id://307160]=note: print w/replies, xml ) Need Help??


in reply to Testing Template, or should I write a diff for TT templates?

Basically, testing your templates and your application shoud be two separate things. You should use your app-testing-templates (core-templates) to test your actual templates, ie designer-processed-templates (production-templates).
  • First do a syntaxt check (making sure there are no template language errors).
  • Then check all the required template elements are present, that is, if the a core-template looks like
    [% IF FOO %] blah blah [% FOO | html %] [% END %] blah blah blah
    then the production-template must also contain an "IF FOO" block inside which the variable "FOO" is filled in, and filtered through "html".
So, I envision somebody writing Template::Test::Structure ( which comes with the commandline frontend tstest ), which would make sure template-new is structurally equivalent to template-original, warning the user of any differences, as in
tstest new original new:34: variable FOO doesn't use FILTER `html' like original:44: in b +lock "IF FOO" new: missing variable BAR like original:66
This is all the template designer should be interested in (a structurally valid template), unless, like merlyn said, they also need to make sure the template is valid xml, which they can go ahead and test by running the application test suite or whatever...

See also Unit Testing Generated HTML

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://307160]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2024-03-28 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found