harness - Commands for the harness package
The harness package implements Tcl commands to interact with a test harness program that was generated using tack. The primary function performed by harness is to encapsulate the communications protocol used by tack generated test harnesses.
The package exports a single ensemble command to connect to a test harness.
The open method creates sockets for the services mentioned as arguments. Services names should be either driver or stub corresponding to the two communications services that a test harness supplies. Commands to control the domain are sent down the driver service port and output from external operations, event tracing and other output from the application are received on the stub service port. The return value of the command is a fully qualified name of a command that has methods that can be used to interact with the test harness. Typically, scripts open both the driver and stub ports as shown below.
set hcmd [harness open driver stub]
The return value from harness open is the name of a command which has the following methods. The return value of the commands associated with interacting with the test harness is a dictionary with the following keys:
code
result
category
domain
plus other keys that are dependent upon the command, as described below.
The invoke method causes the test harness to invoke the domain operation, opname within in domain , domain, passing the opargN arguments.
The read method reads the value of the attr attribute of instance inst of class class in domain domain, returing its value. The inst argument may be either the name of a named instance or a number.
The update method writes the value arguement value to the attr attribute of instance inst of class class in domain domain. The inst argument may be either the name of a named instance or a number.
The event generates the event named, event to the inst instance of class class in domain, domain passing any option values of paramN.
The event generates the polymorphic event named, event to the inst instance of class class in domain, domain passing any option values of paramN.
The delay method operates like the event except the event is delayed by delay milliseconds.
The delay method operates like the polyevent except the event is delayed by delay milliseconds.
The trace turns on state machine tracing if the boolean valued argument, ena, is true and turns off state machine tracing otherwise.
The close terminates the communications connections to the test harness application.
The cget method returns the socket channel identifiers for the given serivce. The service argument must be one of "driver" or "stub". Access to the socket channel is sometimes needed in order to be able to configure the channel, e.g. to post file events or changing its blocking characteristics.
pycca, tack
Copyright © 2012 by G. Andrew Mangogna