Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Yet another meditation on testing

by hardburn (Abbot)
on Feb 14, 2004 at 18:30 UTC ( [id://329009]=note: print w/replies, xml ) Need Help??


in reply to Yet another meditation on testing

What if I change the html, it's just the display layer isn't it? Do I use a dumper to dump the actual variables I'm passing to the template? Isn't that looking at the implementation?

<plug type="shameless">

This is exactly what I wrote HTML::Template::Dumper for. It only works with HTML::Template, and I'm not sure how well a similar module would work for more complex template systems, like TT or HTML::Mason. However, if all your application runs is HTML::Template, you should be able to easily extend your program to use the Dumper version so you can inspect the raw datastructure being sent to the template engine.

----
: () { :|:& };:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Yet another meditation on testing
by BUU (Prior) on Feb 14, 2004 at 21:14 UTC
    That was indeed the module I was thinking of when I wrote this meditation, but you didn't answer my questions about the suitability of using such a module. It seemed to me that testing the datastructure sent to the template would be kind of like testing the code that makes up the subroutine. But on second thought, perhaps those tests combined with other tests.

      IMHO, the general rules of good coding practices should be relaxed when applied to test scripts and debugging. If anything, attempting to parse your way through the raw HTML makes your tests more dependant on implementation details compared to reading the datastructure alone. The things your tests will check are going to be some result that's inside that datastructure anyway, and going through the HTML will just create extra work. You don't necessarily have to check the entire datastructure, but just the pieces you're interested in.

      What HTML::Template::Dumper will do is tie you to using HTML::Template. For the orginization I work for, this isn't much of a problem, because HTML::Template best fits the way we operate (e.g., strict seperation of code and data). Though this isn't an itch I personally have the need to scratch, I would like to see other modules for different template systems and work with the authors to integrate them where we can.

      ----
      : () { :|:& };:

      Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found