Spec-driven test suite
This is a somewhat detailed implementation plan for lynX's "Spec-driven test" idea on the Talk:Strategy page. The theory behind this proposal is that the client server and interserver interactions can be simplified for the purpose of testing if state information for the transactions being tested can be known and treated as inputs, thereby reducing the complexity of the test situation by treating each connection as a finite state machine.
Requirements for test client
The test client should be able to:
- Initialize its state from a configuration file that defines connection and test information as psyc variables.
- Be capable of implementing a simple metalanguage (so that tests can be embedded in a plain text spec).
- Make multiple simultaneous client connections to instances of the server being tested.
- Perform psyctext variable substitution on the spec text to generate the packets it needs to send and the responses it expects to receive.
- Provide transaction logging and diff output comparing the responses received on each connection to those expected.
- Permit a lexical engine to be replaced by a state comparison without a major rewrite (if the initial version does not implement PSYCstate).
- Parse routing and create a new client connection for client roles defined in the spec.
The following features are desirable but may be deferred if necessary to expedite an initial release of the test client:
- Implement the metalanguage (embeddable aspect of the spec) requirement.
- Compare state changes communicated by packets rather than making direct lexical comparisons.
- Implement a listening interface to permit the test client to emulate a server.
The test client that does not implement these would still be useful for developing the spec using the current psyced (below).
Requirements for spec development
The spec should:
- Provide a list of vars to be defined for a given test and a human readable description for each.
- Provide a psyctext transcript of each connection anticipated for a given test.
- Order the spec in a way that successful tests initialize the state for subsequent tests.
- Label individual test specifications as obsolete, deprecated, current, future or experimental with an emphasis on maintaining compatibility with the current spec.
This section describes boot-up and maintenance for an on-going specification and testing process.
- List the features and commands to be tested from the client.
- Draft a client-side script (psyc packets) to be to be used for the test.
- Formalize the metalanguage and markup to be used for spec documents.
- Prepare client.
- Freeze features.
- Prepare spec (client scripts only).
- Run client spec in test client to generate psyc packets for server and inter-server dialog.
- Debug spec.
- Freeze spec.
- Debug reference server.
- Repeat as necessary or desired