On Thu, Apr 30, 2009 at 5:42 PM, Jesse Sheidlower <[email protected]> wrote: > > I assume this is more of a general Perl testing question than > a Catalyst question, but.... > > I finally sat down to write real tests for one of my apps, > with the hopes that I'll do this regularly for everything. I > was using the Tutorial chapter on testing, and the docs for > Test::WWW::Mechanize::Catalyst, for ideas. > > I quickly hit a wall because I couldn't figure out how to run > this with a test database. Since I need to test modification > and deletion stuff, but have real data, I can't just run this > against my actual app. So I figured I would dump the sql from > my production app and have my test program load this into a > database called "test-db" or whatever, having the same format > and schema as the real db, and then just drop the test db at > the end of the test. > > Unfortunately I don't know how to do this from a test script, > and I don't know how to tell TWAM to run a particular app but > with a different DBIC schema (in this case, the identical one > but with a different name, pointing to the test db) instead. > Or how to do the same thing, but with TWAM hitting the app > with the external-server method (so I can test the Apache > deployment). > > Would be grateful for any pointers.
Hmm - first question why a different DBIC schema? Why not use the same schema only connected to a different dsn? And if you go that path - then you can move the connection details (dsn) from the Catalyst model code into a config file. The final step would be to use different config files for the tests and for the real app. -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ http://perlalchemy.blogspot.com/ _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
