The joy of Test

hide on 2004-06-06T17:50:11

If I've learned anything from reading Perl Medic it's the value of writing tests. This is probably old hat to the rest of you, but I just started (well 5 weeks ago) to use them, and I can't believe the impact they've had on my coding.

Previously my testing would be done by printing variables and return values of functions, relying on my eye to catch any issues. While serving me well it wasn't very good for my productivity. Since writing tests (using Test::More and Test::Exception) I've been able to write more code, with increased confidence, and better results

Now I need to create test suites for our web application using WWW::Mechanize and get the other developers on my team to buy into them. Wish me luck (although I shouldn't need it).


Mech and tests

petdance on 2004-06-06T18:50:46

Mechanize and testing! Two of my favorite topics!

I'm trying to envision a WWW::Mechanize::Tester that has methods for common testing tasks, although I don't yet know what would be in it. Suggestions?

Re:Mech and tests

hide on 2004-06-12T13:39:14

I've managed to convince my co-workers the value that running tests with WWW::Mechanize will provide us, and they are all on board.

One of them has taken the task of making sure all the links on a page are correct, all images are accessable, and that dynamicly generated pages match an existing HTML file.

I don't know if other people will require such tests, but this is the direction we're heading toward at this point.

Re:Mech and tests

petdance on 2004-06-13T02:13:57

Any of that code he'd like to feed back, I'll be glad to take it. I'd love to have a "check this page" bot included with the Mech distro.

the joy of tests

garyaj on 2004-06-07T00:37:29

Brian Ingerson's Test::FIT module has been my "most useful module" recently. The ability to provide a browser-based summary of test results has got my managers yelling for more. I've set up a cronjob which runs a large suite of tests of the company's website continuously (using WWW::Mech) and the managers get a page of green squares if all is well or red or yellow squares if something breaks. They love it and thus keep paying me to add more tests. (Lots of pretty colours.)

Quite coincidentally (:^) the tests are also useful for development and pre-production testing as you have discovered.