Justin Simoni wrote:

> Does anyone else have a better strategy for testing the structure of  
> their HTML::Template templates? 

I've done 2 things in the past.

1) Load each template, use the query() method to find out what the vars and
loops are and fill them in with fake data. Then test the output.

PROS:
  * you can make sure your tmpl_* syntax isn't fatally wrong
  * you don't need to worry about templates being valid HTML, just the resulting
output.

CONS:
  * you're still at the mercy of something like HTML::Lint and it's bugs
  * you're not testing whether or not someone mispelled a variable name, etc

2) Test the modules that use the templates, not the templates themselves.

PROS:
  * Tests not only the logic in the controller classes, but also that the vars
are being passed correctly to the template with the right names.

CONS:
  * Not as easy to write. You can't just write one test that tests all your
templates. Plus you need to make sure you exercise every case so that every
template is used.

I prefer #2.

-- 
Michael Peters
Developer
Plus Three, LP


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Html-template-users mailing list
Html-template-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to