2004-11-17 22:28:16 UTC
I've kickstarted a test suite for RSS::Parser, using the one included
in the Windows one-click installer for Ruby 1.8.2preview3. The idea is
to leverage on prior art test cases picked up from Mark Pilgrim's
Universal Feed Parser: each test case is included in a single XML file,
with instructions in comments at the beginning of the file about what
to assert, and an occasional description or note. The Ruby driver for
the test case is nothing more than a Test::Unit::TestCase able to
dynamically add to itself a test method for each of the XML files: the
Test::Unit package does all the other magic.
At the moment, I've implemented about 50 cases amongst the 134 XML
files in the wellformed/rss directory of the Universal Feed Parser test
suite archive. There already are failures and errors, but some are
probably due to myself being unfamiliar to the model of the data
mangled by RSS::Parser. For example, I've imported 'rss/dublincore' but
still seem to be unable to access 'dc_subject' and 'dc_author' fields
in both item and channel.
Note that every test is run without activating the validation option in
RSS::Parser. For validation, the right test suite to use is the one
from the Feed Validator by Sam Ruby and Mark Pilgrim, which is built
around the same scheme, that is XML files containing a single fixture.
I don't know how much time I'll have in the future to continue porting
those suites to RSS::Parser: that's why I'd like to call my little
effort a "kickstart", hoping someone else who sees value in this
approach decides to pick up where I left and keep porting test cases
and then maintain the overall suite.
Share and enjoy!