Apache James Mail Protocol Tester (MTP) is a library providing a framework for the scritable functional testing of ASCII based line protocols.
This contains a lightweight scripting framework suitable for the functional testing of the ASCII line based protocols common in mail. A script contains a list of client requests and templated server responses. The framework runs the client lines against a host system and then compares the server lines received in response against the template responses.
MPT is a lightweight, flexible framework which is capable of being used
in a variety of ways. HostSystem is pivotal, defining the
interface between the framework and the server system under test.
ExternalHostSystem implementation connects to a port on a server.
This is typically used to test a complete running server (including the sockets).
MPT AntLib provides an
Ant task suitable for this use case.
Example:
# # This script is a basic SMTP HELO. # S: 220 localhost. SMTP Server \(JAMES SMTP Server .* C: HELO example.org S: 250 localhost. Hello example.org .* C: QUIT S: 221 2.0.0 localhost. Service closing transmission channel
The server responses in the script support regex matching. Java Pattern is used for the regex comparison and so the syntax is identical.
Variables of form ${variable-name} may be substituted by values
passed into the script builder before interpretation.