A spec is only as good as the test suite it ships with.
With that in mind, here's a first pass at what I would like to see a test suite test on an Atom API implementation. How about filling up the comments with all the stuff I missed? Thanks.
Start with a URL to a web page:
- Find a link to the FeedURI (rel="service.feed") on the web page
- Find a link to the FeedURI in the auto-discovered Atom feed on the same page.
- Confirm it is a valid Atom Feed.
- Find it's PostURI (rel="service.post" in \feed)
Start with a perfectly valid and complete Atom Entry fit for POSTing to a PostURI. We'll call that perfectly valid and complete entry the Canonical entry. Cycle through each test in the table below. After each step, reset the Atom Entry to the Canonical entry. The 'ex' namespace used below is declared as xmlns:ex='http://example/com'.
For each step in the test, there is an XPath Action. This is a shorthand that uses XPath notation to define how the Canonical entry is to be modified. Here are some examples:
Means to insert a
modified element as a child of the
element, and set it's value to be 2003-06-31T23:58:00.
link child of
Status Code is the HTTP status code that the server should respond with when receiving such a request.
Response Constraint defines further tests on the response sent back from the server, beyond just the HTTP status code.
|XPath Action||Status Code||Response Constraints|
|(none)||201  |
|\entry\title=""||201||Confirm \entry\title in response is empty.|
|\entry\summary=""||201||Confirm \entry\summary in response is empty.|
|\entry\content\@type='text/xml'||201||Confirm that attibute is set the same in the response.|
|\entry\content\@mode='xml' \entry\content\@type='application/xhtml+xml'||201||Confirm both attrs are set in the response.|
|delete \entry\content||201||\entry\content=="" or there is no \entry\content|
|\entry\issued=""||201||\entry\issued != ""|
|insert \entry\ex:newtag||201||May or may not appear in the response|
- All 201 responses MUST include a Location: header.
- Complete means all optional elements are present and have non-empty elements. All attributes are set explicitly and are set to default values.
- All 400 responses MUST NOT return a Location: header.
- Confirm that all the 'right' elements are returned with the response body with the correct values. That is: make sure title matches title, etc.
- Summary may or may not be present in the response, so nothing to test here.