Closed Bug 279150 Opened 20 years ago Closed 19 years ago

RSS/Atom parsers should have unit tests

Categories

(MailNews Core :: Feed Reader, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: sayrer, Assigned: sayrer)

References

Details

Attachments

(8 files, 3 obsolete files)

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; rv:1.7.3) Gecko/20040913 Firefox/0.10 Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; rv:1.7.3) Gecko/20040913 Firefox/0.10 It's my experience that the only way to deal with variations in RSS feeds is to have a large amount of unit tests. I've asked around a little, and have gotten donations of a couple huge unit test libraries. Plus, there's the brand new RSS1.1, which has unit tests in the public domain. Right now, Feed.js is structured in a way that makes it difficult to test the parsers. I was thinking that the parsers could be moved out of Feed, and into their own classes. That way, they could be fed test feeds from xpcshell. Thoughts? I'm up for doing this. Reproducible: Always Steps to Reproduce:
Hardware: Macintosh → All
Attached file FeedParser.js -- new file (obsolete) —
couldn't figure out the CVS incantation to let me add new file w/ anon access. For use with the following patch.
Attachment #172058 - Flags: review+
Right now, the parsing code is very tied up with the download code. This patch makes it possible to unit test the parsers from the command line (I have hundreds of test files ready to add...).
Attachment #172059 - Flags: review+
Comment on attachment 172058 [details] FeedParser.js -- new file I think you meant to make these question marks not plusses since your asking for a review
Attachment #172058 - Flags: review+ → review?(mscott)
Attachment #172059 - Flags: review+ → review?(mscott)
(In reply to comment #3) > (From update of attachment 172058 [details] [edit]) > I think you meant to make these question marks not plusses since your asking > for a review > Oops. Yes, that's what I meant. Knowing is half the battle. I'm surprised it let me do that...
robert, did you make this patch from a 1.0 branch or from the mozilla trunk. That effects what I should do with this change since the parser is slighty different in the two places.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Target Milestone: --- → Thunderbird1.1
(In reply to comment #5) > robert, did you make this patch from a 1.0 branch or from the mozilla trunk. > That effects what I should do with this change since the parser is slighty > different in the two places. I made it against the trunk.
Version: unspecified → Trunk
You might want to take a look at the changes I made to your original patch. While I was here I did a lot of general cleanup / code re-organization that was unrelated to what you were trying to do. You can now create a Feed parser instance by doing something like the following: // create a feed parser which will parse the feed for us var parser = new FeedParser(); this.itemsToStore = parser.parseFeed(this, this.request.responseText, this.request.responseXML, this.request.channel.URI);
Attachment #172058 - Attachment is obsolete: true
Attachment #172059 - Attachment is obsolete: true
Attachment #172059 - Flags: review?(mscott)
Attachment #172058 - Flags: review?(mscott)
I just checked my patch in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
(In reply to comment #7) > > You can now create a Feed parser instance by doing something like the > following... OK, how would you like the unit tests structured? It would be great if you could point me at some part of the tree that's structured the way you'd prefer to do this. I saw that /js/ has a unit test approach, but I'm not sure that's appropriate.
Did you mean to close this? The parsers don't have unit tests yet :).
Attachment #174168 - Flags: review?(mscott)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
the trunk is giving every message an id of <undefined> right now.
Attachment #174299 - Flags: review?(mscott)
Attachment #174299 - Flags: review?(mscott) → review+
http://intertwingly.net/blog/index.atom uses relative references. This patch makes that work.
Attachment #174168 - Attachment is obsolete: true
Attachment #174311 - Flags: review?(mscott)
Attachment #174168 - Flags: review?(mscott)
Comment on attachment 174311 [details] [diff] [review] Make Atom links use xml:base, change commenting style i checked this in
Attachment #174311 - Flags: review?(mscott) → review+
Assignee: mscott → sayrer
Status: REOPENED → NEW
Status: NEW → ASSIGNED
Change to '*' on the license block so xpcshell can load the file. sr bienvenu as mscott is on vacation.
Attachment #205566 - Flags: superreview?(bienvenu)
Got a test harness set up, but XPCShell is acting strange with DOM classes. See bug319968.
Depends on: 319968
Attachment #205566 - Flags: superreview?(bienvenu) → superreview+
This file is setup code for use with jsDriver.pl, the JS unit testing script. It scans a directory full of XML files that lead with a comment like this: <!-- Description: dc:date is the date of the entry Expect: feed.items[0].date = '2005-12-07T14:48:03-05:00' --> That way the test code can eval() the Expect: value to see if it's correct, and you don't actually have to write test js files for the parser.
Target Milestone: Thunderbird1.1 → Thunderbird2.0
related bug 320967: add tests for content:encoded in all feed formats.
related bug 324179: make sure we don't match elements at the wrong nesting level
the new toolkit feedparser has ~150 unit tests. We should move Thunderbird to that ASAP.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago19 years ago
Resolution: --- → WONTFIX
Target Milestone: Thunderbird2.0 → ---
Component: RSS → Feed Reader
Product: Thunderbird → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: