docs/index.md

Thu, 23 Mar 2023 12:14:53 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 23 Mar 2023 12:14:53 +0000
changeset 172
2c17151ed21b
parent 166
5d39804f108b
permissions
-rw-r--r--

client: Fix timeout handling

Previously, the timeout handler would fire an error that would get caught and
logged by the timer code. However that error never reached the upper levels of
scansion, leading to the whole thing just hanging.

Now we just trigger resumption of the async runner, and throw the error from
there if we haven't received the stanza yet.

With this change, timeouts are now correctly handled and reported as failures.

# Scansion - Automated XMPP Client

Scansion is an automated scriptable XMPP client, useful for testing and
automating tasks. It is primarily designed to be a handy tool in an XMPP
developer's toolbox, however its scripting language is designed to be easy
to read and write by non-programmers who understand basic XML and XMPP.

An example Scansion script:

```xml
# Pubsub: Test node creation

[Client] Romeo
        jid: admin@localhost
        password: password

[Client] Juliet
        jid: juliet@localhost
        password: password

---------

Romeo connects

# Create the node
Romeo sends:
	<iq type='set' to='pubsub.localhost' id='create-node'>
		<pubsub xmlns='http://jabber.org/protocol/pubsub'>
			<create node='princely_musings'/>
		</pubsub>
	</iq>

# Server acknowledges successful creation
Romeo receives:
	<iq type='result' id='create-node'/>

# Juliet sees the node appear in the node list

Juliet connects

Juliet sends:
	<iq type='get' id='list-nodes' to='pubsub.localhost'>
		<query xmlns='http://jabber.org/protocol/disco#items'/>
	</iq>

Juliet receives:
	<iq type='result' id='list-nodes' from='pubsub.localhost'>
		<query xmlns='http://jabber.org/protocol/disco#items'>
			<item xmlns='http://jabber.org/protocol/disco#items' jid='pubsub.localhost' node='princely_musings'/>
		</query>
	</iq>

# Yay!

```

This example demonstrates how Scansion:

- Supports multiple characters in a script
- Takes care of establishing a connection and authentication
- Automatically verifies responses to stanzas

This final point is what makes Scansion a great tool for testing - it
has a flexible matching system that allows you to ensure a certain stanza
receives the response you expect.

mercurial