(Yet Another?) RSS::Parser test suite

  • Thread starter Giulio Piancastelli
  • Start date
G

Giulio Piancastelli

Hi all,

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.

Download at
http://www.mycgiserver.com/~gpiancastelli/blog/gems/rubyRSSParserTest.zip
Share and enjoy!

Best Regards,
Giulio Piancastelli.
 
G

gabriele renzi

Giulio Piancastelli ha scritto:

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.

this is indeed a nifty way of testing, thanks for sharing and building
up the test suite.

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.

IMVHO, it would be nice if Kouhei Sutou could include this in the
RSS::parser test suite, but obviously there would be duplication with
the stuff that is already there. Kouhei, what do you think of this?
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"(Yet Another?) RSS::parser test suite" on Thu, 18 Nov 2004 07:28:16 +0900,
Giulio Piancastelli said:
There already are failures and errors

channel_author.xml:
Why does /rss/channel/author exist? RSS 2.0 spec.(*)
doesn't say it exists.

(*) http://blogs.law.harvard.edu/tech/rss

channel_dc_author.xml:
I can't find the specification of RSS 2.0 with Dublin
Core.

channel_dc_subject.xml:
ditto.

item_dc_author.xml:
ditto.

item_dc_subject.xml:
ditto.

item_enclosure_multiple.xml:
Where is the description of multiple enclosures?

rss_namespace_*.xml:
Where is the description of RSS with namespace?

rss_version_090.xml:
RSS Parser doesn't support RSS 0.9.

rss_version_201.xml:
I can't understand what means this test.

rss_version_21.xml:
ditto.

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.

Where is the specification of RSS 2.0 with Dublin Core? I
can't support it, if it doesn't exist. Because of
validation.
 
G

Giulio Piancastelli

Hi Kouhei,

I'm going to address your concerns in a moment, but apart from the
details of every single test case, I'd like to know your opinion about
the employed technique of testing. Indeed, I'd also like to see an
example from your current test suite: where could I find such a case?
channel_author.xml:
Why does /rss/channel/author exist? RSS 2.0 spec.(*)
doesn't say it exists.

(*) http://blogs.law.harvard.edu/tech/rss

item_enclosure_multiple.xml:
Where is the description of multiple enclosures?

rss_namespace_*.xml:
Where is the description of RSS with namespace?

In fact, I picked up tests from Mark Pilgrim's Universal Feed Parser
without effectively worring about RSS specifications and such. I
perceive him and his work as somewhat authoritative in the syndication
field.

On the other hand, checking the specification, nowhere is stated that,
for example, there could be multiple enclosure elements in an item;
but, there's nowhere to be explicitly said that there could be only ONE
enclosure element in an item as well. You just suppose that there's a
single enclosure for each item because that's probably the more natural
way of thinking about it.

My attempt is a proposal to leverage on prior art test cases also as a
way to better understand the fragmented world of syndication formats. I
firmly believe that, to use test cases from the Feed Validator and
Universal Feed Parser project, it is not enough to turn to
specifications, especially when those specifications are a sloppy as
the RSS 2.0 one: there's something new to learn, and something old to
re-learn at every step. See my comments about RSS plus Dublin Core and
RSS versions as an example of that.
rss_version_090.xml:
RSS Parser doesn't support RSS 0.9.

OK, so feel free to change the test, or the Ruby driver. As I
previously stated, some errors are due to my being unfamiliar with the
whole model used by RSS::parser. This is probably one of such cases.
Besides, my driver just tries to do some tests on the RSS 2.0 parser:
if you are going to adopt such testing technique, you'll probably have
to write different drivers for different RSS versions (especially 1.0
and 2.0) or require more modules, depending on how you implemented
things. Anyway, this means that the driver would have to be modified in
the future.
rss_version_201.xml:
I can't understand what means this test.

rss_version_21.xml:
ditto.

"There are more RSS version in heaven and earth, Horatio, than are
dreamt of in your philosophy." ;)
See: http://diveintomark.org/archives/2004/02/04/incompatible-rss
Where is the specification of RSS 2.0 with Dublin Core? I
can't support it, if it doesn't exist. Because of
validation.

There is obviously NO specification of RSS 2.0 with Dublin Core. If it
were, you'll have to provide a similar specification for EVERY SINGLE
NAMESPACE people would like to add elements from, and this is quite
unfeasible, you see.

On the other hand, the RSS 2.0 specification you pointed me to says:
"RSS 2.0 adds that capability [of being extensible], following a simple
rule. A RSS feed may contain elements not described on this page, only
if those elements are defined in a namespace."
These days a number of RSS 2.0 feeds offer Dublin Core elements. Even
if there could be an arguable degree of funkiness within those
practices, that's a fact you definetely have to cope with.
Best Regards,
Giulio Piancastelli.
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"Re: (Yet Another?) RSS::parser test suite" on Fri, 19 Nov 2004 21:23:17 +0900,
Giulio Piancastelli said:
I'd like to know your opinion about
the employed technique of testing.

It's a good way for testing external API. I'll import it if
you maintain it.
Indeed, I'd also like to see an
example from your current test suite: where could I find such a case?
http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/test/rss/

On the other hand, the RSS 2.0 specification you pointed me to says:
"RSS 2.0 adds that capability [of being extensible], following a simple
rule. A RSS feed may contain elements not described on this page, only
if those elements are defined in a namespace."

I know it.
These days a number of RSS 2.0 feeds offer Dublin Core elements. Even
if there could be an arguable degree of funkiness within those
practices, that's a fact you definetely have to cope with.

Do you want RSS Parser to support Dublin Core in every RSS
2.0 element? Or some elements?


Regards,
 
A

Austin Ziegler

Kou:
Do you want RSS Parser to support Dublin Core in every RSS
2.0 element? Or some elements?

This is one of the problems that I had while examining proper RSS
2.0 support in the RSS (parsing and generating) library that I was
working on before yours was imported into the Ruby CVS. I didn't
come up with an acceptable way to make it work for either parsing or
generating, but essentially, the spec allows for *any* element or
attribute in the RSS feed so long as it is marked with a namespace.

So, yes. The RSS parser must support Dublin Core -- and anything
else -- with a namespace.

-austin
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"Re: (Yet Another?) RSS::parser test suite" on Sun, 21 Nov 2004 23:59:33 +0900,
Austin Ziegler said:
generating, but essentially, the spec allows for *any* element or
attribute in the RSS feed so long as it is marked with a namespace.

Yes. The spec of RSS 2.0 *only* allows RSS feed can have any
element or attribute which are defined in a namespace. (It
is same as the spec of RSS 1.0.) It says that we *can* add
any model to the RSS 2.0 and specific it.

If someone specific RSS 2.0 Dublin Core module like RSS
1.0's one, I'll be glad and support it.
# Does someone do it?

I want to make clear why RSS Parser supports XXX (which is a
feature of RSS Parser) or not. I think that the reason that
is `many RSS 2.0 feeds use it, so RSS Parser must support
it' is weak reason.

So, yes. The RSS parser must support Dublin Core -- and anything
else -- with a namespace.

OK, if there is the spec of it.

RSS Parser supports TrackBack module for both RSS 1.0 and
2.0. Because there is the spec of them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top