Discussion:
(Yet Another?) RSS::Parser test suite
(too old to reply)
Giulio Piancastelli
2004-11-17 22:28:16 UTC
Permalink
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.
gabriele renzi
2004-11-18 11:23:17 UTC
Permalink
Giulio Piancastelli ha scritto:

<snip>
Post by Giulio Piancastelli
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.
Post by Giulio Piancastelli
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?
Kouhei Sutou
2004-11-19 09:38:19 UTC
Permalink
Hi,

In <***@z14g2000cwz.googlegroups.com>
"(Yet Another?) RSS::Parser test suite" on Thu, 18 Nov 2004 07:28:16 +0900,
Post by Giulio Piancastelli
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.
Post by Giulio Piancastelli
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.

--
kou
Giulio Piancastelli
2004-11-19 12:23:17 UTC
Permalink
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?
Post by Kouhei Sutou
Why does /rss/channel/author exist? RSS 2.0 spec.(*)
doesn't say it exists.
(*) http://blogs.law.harvard.edu/tech/rss
Where is the description of multiple enclosures?
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.
Post by Kouhei Sutou
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.
Post by Kouhei Sutou
I can't understand what means this test.
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
Post by Kouhei Sutou
Post by Giulio Piancastelli
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.
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.
Kouhei Sutou
2004-11-21 06:18:35 UTC
Permalink
Hi,

In <***@f14g2000cwb.googlegroups.com>
"Re: (Yet Another?) RSS::Parser test suite" on Fri, 19 Nov 2004 21:23:17 +0900,
Post by Giulio Piancastelli
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.
Post by Giulio Piancastelli
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/
Post by Giulio Piancastelli
"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.
Post by Giulio Piancastelli
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,

--
kou
Austin Ziegler
2004-11-21 14:59:33 UTC
Permalink
Post by Kouhei Sutou
Post by Giulio Piancastelli
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?
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
--
Austin Ziegler * ***@gmail.com
* Alternate: ***@halostatue.ca
Kouhei Sutou
2004-11-23 04:54:42 UTC
Permalink
Hi,

In <***@mail.gmail.com>
"Re: (Yet Another?) RSS::Parser test suite" on Sun, 21 Nov 2004 23:59:33 +0900,
Post by Austin Ziegler
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.
Post by Austin Ziegler
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.


--
kou
# I hate RSS 0.9x/2.0. Is it really simple??? :-P

Loading...