Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Having two sets of templates is a bad idea from a testing standpoint. Testing is used to determine that the system behaves as you expect. It is more important that the production templates produce the right output. The test templates are something else that need to be maintained and they don't test that the production templates haven't been broken.

There are two things that should be tested with templates. First, is that the program is passing the right data to the template. This is an interface question. This could be tested by writing a test template that just exercises the data. A better option is to have the tests directly examine the data.

The second thing is that the templates produce the right output. Checking the output of the test template doesn't detect that the designer broke the production templates. A better test is to use pass test data to the production template. YAML would work very well for storing the test data. And then compare the output to a sample.

Another possibility is to parse the production templates to produce the test templates. For example, removing all the HTML just leaves the directives. This could be compared to a sample whihc are basically the test templates you are talking about. This catches if the designer is not allowed to change the directives. If you are more concerned that the template directives work, then these could be run against the test data and the results compared to a sample.


In reply to Re: Re: Re: Testing Template, or should I write a diff for TT templates? by iburrell
in thread Testing Template, or should I write a diff for TT templates? by EvdB

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-16 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found