chromatic and I gave our "Solutions to Common Testing Problems" talk today. People (I'd estimate about 250) wedged themselves into the 89 Chestnut hotel to watch us chat about and show examples of testing databases, web sites, complex data structures, and more. Instead of slides, c and I dove straight into code, explaining the files and concepts as we went along. Since this was a live presentation, we were able to make "Look what happens when I do this" changes, which are always fun.
In a genius move, Allison arrived with a box of spiral-bound, two-chapter, full-color-cover samples of PTDN. The book featured chapters 2 and 4, a combination of the freely-downloadable chapter 4 and the yet-unpublished chapter 2. One of the terrific YAPC volunteers handed these out to people who asked questions.
Speaking of questions, I got hit hard with HTML/XML testing questions that were just outside my knowledge. What I can remember are:
- Does WWW::Mechanize handle JavaScript? Mike Fragassi and I discussed this afterward. As Mike pointed out, there is currently no standalone JavaScript implementation that handles the DOM model. Think about how the addition of JavaScript processing to WWW::Mechanize could make Perl a valuable testing tool for AJAX applications! ()
- Can you rip out a specific part of a page to test with HTML::Lint? Unsure how I'd do this offhand. Mech provides the content of the page, and I'd probably use one of the HTML-processing modules to extract the section I'd want to test.
- What about testing XML? There are a handful of modules that allow you to test XML. Personally, I've had great experiences with Test::XML::XPath. If you wanted to test the XHTML validity of a page, I'd probably pipe it to the
tidy
utility with the -asxhtml
option and check the exit status. (I don't see a way to add that option to any HTML::Tidy objects.)
There were a few more, but I can't remember them. Time for sleep now.
testing JavaScript
perrin on 2005-06-28T16:13:03
Keep in mind, WWW::Mechanize and HTTP::Recorder work 100% fine for testing all the server-side interactions for Ajax or any other web application that uses HTTP. It can't test your actual JavaScript code, but it can't test that your HTML looks okay either, so I tend to lump that sort of client-side testing together as a separate task from server-side testing.