I'm double posting this to standards and interop, but generally this is a
conversation for interop that I thought you should all be aware of.  Peter,
I notice the interop group is not on the discussions page.

For the past 6 months, we've been discussing on creating a standardized test
suite as a tool for XMPP Server developers, and perhaps in the future for
further purposes.  There was discussion of having a hosted solution that can
execute scripts from a list of supported language, but this plan was
scrapped at the last summit.  What we came up with instead is a simple
XPath-Expect script of our own design that we can easily build an
interpreter for.

There will be some basic commands: expect, get, send, assert, foreach_sub,
if_xpath, include, etc as well as built-in helper functions to jump the
script to the right state in the connection without having to be explicit.
There also needs to be some functions for building out stanzas and payload
element trees.  Any xml argument could be a stanza object or string.

stream = connect('u...@xmpp.org/resource', 'password');
start_session(stream); # this command gets us through all of the stream
features, authenticated, and bound. This of course, could be done with the
send/expect commands as well. There may be other such commands that get us
to the state we need.

id = unique_id();
result = send(stream, ("<iq type='get' to='xmpp.org' id='%s'><query
xmlns='jabber:iq:roster' /></iq>", id), ("[xpath statement with %s for id]",
id));
#OR
iq_roster = makeIq('get', 'xmpp.org');
query = makeElement('{jabber:iq:roster}query');
append_xml(iq_roster, query);
id = get(iq_roster, '@id');
assert(result, ([xpath], [replacement values],));

foreach_sub(result, sub, ([xpath],)) {
    assert("Testing item structure", sub, ([xpath]));
    group = get(sub, ([xpath],));
    # do something with groups here
}

This is the direction things are heading.  The syntax is just something that
we came up with at the last summit but I've exptended it. Perhaps is over
complicated for the task.  Perhaps these test scripts should be written in
XML in order to avoid specialized parsers.  Are there any decent
C-syntax-style parsers out there already?  In any case, I'd like to hear how
people think this should be done.

Thanks,
Nathan Fritz

Reply via email to