First test cases for Contacts API; JavaScript-based prototype


As per my ACTION-298, I have started working on a test suite for our
Contacts API; I have developed so far 7 simple test cases, available at:

Note that if you don't have a system supporting navigator.contacts,
these test cases won't give any useful result (but see below on
prototype implementation.)

The tests use the HTML/WebApps Test Harness [1] as we had agreed on. The
tests that look at the returned data rely on contacts data that need to
be imported before running the test suites and which are linked (as
vcard data) from the relevant test cases.

Since developing test cases without a matching implementation is no fun,
I've also developed a simple JavaScript prototype (with an hardcoded
addressbook at this time), attached to this message. It currently passes
the 7 test cases :) It can be used with the test cases by putting it in
the parent directory of the "test-cases" directory (since the test cases
link to a "../impl.js"). I'm not sure if I should put it in the
repository, and if so, where. It could probably be used as a basis for
implementations relying on remote sources for contacts.

Unsurprisingly, I've found some bugs in the spec while developing the
test cases and the implementation; I wonder if I should send them now or
as part of the Last Call period.

Also, I went with as a repository to host the test suite, but
the others groups are using the mercurial-based decentralized versioning
control system at (with a visible check-out at; I think it would make sense to align with that, but since
that involves using another system, I didn't want to proceed with that
without some notion on how confident potential test contributors would
feel with that.

I would like to start marking up the Contacts API spec with test
assertions markers to be able to compute coverage and get an idea of
what needs testing, but again, I'm hesitant to do that while the spec is
on path towards Last Call.

Feedback and comments would be most welcomed.



Received on Tuesday, 24 May 2011 08:22:32 UTC