|XP is just a number|
Testing TT and CDBI under Catalystby dragonchild (Archbishop)
|on Jun 27, 2005 at 13:36 UTC||Need Help??|
dragonchild has asked for the
wisdom of the Perl Monks concerning the following question:
I've just started to dive into Catalyst and I have to say I'm loving it. It makes the easy things easy, provides the right framework to work in, and has been the impetus for me to really start learning TT and CDBI. One of best things is that Catalyst creates the initial test scaffolding for you, broken down by functional area. So, you have your application tests, and then the tests for each of the MVC components in their own subdirectory of t/. It even comes with its own Apache::Test-like infrastructure, so you can test without needing Apache or mod_perl installed. However, I'm not sure what I should be testing.
With the controllers, I'm pretty comfortable with the idea of mocking up the appropriate model and view classes so that I know what I'm testing. So, that's not a big issue.
With respect to CDBI, Catalyst uses Class::DBI::Loader to auto-generate the CDBI classes for you, based on your schema. My CDBI classes literally look like:
I've looked at Automated testing of database classes, but then I realized that since I'm not modifying the classes, any additional tests I write beyond the use_ok()-type tests will be testing CDBI::Loader, and so they shouldn't be in my application's test suite. So, should I write any tests here? I'm comfortable without any, but am I missing something?
With respect to TT, I've got a lot of .tt files that get PROCESS'ed into my templates, where appropriate. I also have a lot of BLOCKs, WRAPPERs, and the like. Catalyst provides a MyApp::V::TT, but that's the place where Catalyst ends and TT begins. I've got my TT configuration options and some every-page values (like my menubar), but I'm not testing any of the actual TT code. Ideally, I'd like testing the actual TT snippets, but I'm at a loss for where to begin. An additional facet is that a lot of these snippets are probably going to be used in other projects, so I'd ideally like for them to have their own test suites ... ?
Basically, I'm literally asking for wisdom here. Catalyst, CDBI, and TT are all amazing infrastructures, but they're very daunting and I'm at a loss for where to begin when it comes to a test suite.
My criteria for good software: