[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Yet Another?) RSS::Parser test suite

Giulio Piancastelli

11/17/2004 10:27:00 PM

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/rubyRSSPars...
Share and enjoy!

Best Regards,
Giulio Piancastelli.

7 Answers

gabriele renzi

11/18/2004 11:21:00 AM

0

Giulio Piancastelli ha scritto:

<snip>
>
> 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?

Kouhei Sutou

11/19/2004 9:38:00 AM

0

Giulio Piancastelli

11/19/2004 12:19:00 PM

0

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.ed...
>
> 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/incomp...

> > 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

11/21/2004 6:19:00 AM

0

Austin Ziegler

11/21/2004 3:00:00 PM

0

Kou:
>> 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 * halostatue@gmail.com
* Alternate: austin@halostatue.ca


Kouhei Sutou

11/23/2004 4:55:00 AM

0

Gray Ghost

5/26/2011 4:59:00 AM

0

rfischer@sonic.net (Ray Fischer) wrote in news:4dddcfe6$0$2210
$742ec2ed@news.sonic.net:

> Gray Ghost <grey_ghost471-newsgroups@yahoo.com> wrote:
>>rfischer@sonic.net (Ray Fischer) wrote in news:4ddb2a06$0$2179
>>$742ec2ed@news.sonic.net:
>>
>>> Gray Ghost <grey_ghost471-newsgroups@yahoo.com> wrote:
>>>>rfischer@sonic.net (Ray Fischer) wrote in news:4dd9d0bf$0$2165
>>>>$742ec2ed@news.sonic.net:
>>>>
>>>>> Gray Ghost <grey_ghost471-newsgroups@yahoo.com> wrote:
>>>>>>Tom Jigme Wheat <thomaswheat1975@gmail.com> wrote in news:d313ff78-
>>fd51-
>>>>>>4a2f-9ef7-a5b2cf5830b4@z15g2000prn.googlegroups.com:
>>>>>>
>>>>>>> The Origins and Evolution
>>>>>>> of the Palestine Problem:
>>>>>>> 1917-1988
>>>>>>
>>>>>>It's simple. Antisemitic muderering scum Arabs.
>>>>>
>>>>> And there is exactly the same hate the Nazis used to exterminate the
>>>>> Jewish "scum".
>>>>
>>>>Yeah? What was the Jewish equivalent of HAMAS in 1920s Germany?
>>>
>>> http://en.wikipedia.org/wiki/Resistance_during_Wo...
>>
>>So you equate an organization that is considered a terrorist organization
>>by most of the civilized world, conducts suicide bombings and rocket and
>>mortar attacks against civilian targets
>
> Just as resistance fighters did.
>

Um, no. I do not know of any resistance groups that targeted civilians who
were not otherwise Jew killing scumbags.

Keep it up. You're a Nazi, antisemite, terrorist apologist. I'll bet your
mom is so proud.

--
Herman Cain for President! http://herma...
If you don't support him you are a Racist!!
He beat Cancer. He'll beat Obama (who is just like cancer)

Remember Desert One, Carter 0? Ain't it sad to wish that Obama had as much
ambition but being glad he doesn't knowing he doesn't have THAT much
competence?