Differences between revisions 2 and 4 (spanning 2 versions)
Revision 2 as of 2008-02-28 05:35:39
Size: 1958
Editor: TimoSirainen
Comment:
Revision 4 as of 2008-02-28 06:34:24
Size: 2177
Editor: TimoSirainen
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The test file begins with a header, followed by an empty line and then a list of commands. The tests consist of two files in the test directory:

 * <name>
 * <name>.mbox

The test
file begins with a header, followed by an empty line and then a list of commands. Messages are appended to the test mailbox from the test.mbox file.
Line 27: Line 32:
{{{
Line 29: Line 35:
}}}
Line 31: Line 38:
{{{
Line 34: Line 42:
}}}
Line 35: Line 44:
Connection number is used if there are more than one connection. The first way is faster to write, while the second allows matching reply's <prefix>. Connection number is used if there are more than one connection. The order of untagged replies doesn't matter. The first way is faster to write, while the second allows matching reply's <prefix>.

ImapTest Command/Reply Testing Configuration

The tests consist of two files in the test directory:

  • <name>

  • <name>.mbox

The test file begins with a header, followed by an empty line and then a list of commands. Messages are appended to the test mailbox from the test.mbox file.

The header contains "key: value" pairs. Allowed keys are:

  • capabilities: Space-separated list of capabilities required from the server for this test. If server doesn't have these capabilities, the test is skipped. (FIXME: Checking not done currently)
  • connections: Number of connections to use for executing this test. If using 2 or more connections, each command must begin with the connection number which is used for the command (1..n). Default is 1.
  • state: nonauth, auth or selected. If selected is used, the mailbox is recreated and test messages are appended to it automatically. Default is selected.

For example:

capabilities: CHILDREN LIST-EXTENDED
connections: 2
state: auth

Commands

There are two ways to configure commands:

1)

[<connection #>] OK|NO|BAD <command>
[* <tagged reply>] (0 or more)

2)

[<connection #> <command>
[* <tagged reply>] (0 or more)
OK|NO|BAD [<prefix>]

Connection number is used if there are more than one connection. The order of untagged replies doesn't matter. The first way is faster to write, while the second allows matching reply's <prefix>.

For example:

# way 1)
ok select $mailbox
* 0 exists

# way 2)
select $mailbox
* 0 exists
1 ok [read-write]

Variables

Commands and replies can have $variables. If a variable doesn't have value when it's matched against server input, the variable is initialized from the server input. This allows doing this like:

ok fetch 1,2 uid
* 1 fetch (uid $uid1)
* 2 fetch (uid $uid2)

ok uid store $uid1,$uid2 flags \seen
* 1 fetch (uid $uid1 flags (\seen))
* 2 fetch (uid $uid2 flags (\seen))

There are also some predefined variables:

  • $mailbox: Mailbox used for testing. box command line parameter specifies this. The default is "imaptest".

None: ImapTest/ScriptedTests (last edited 2023-11-07 21:12:13 by TimoSirainen)