Testing a program using a TorX adapter

A TorX adapter is a program that implements an interface to the system under test. JTorX starts a configured TorX adapter program at the end of a test run, and stops it at the end of the test run. JTorX interacts with a TorX adapter program by writing commands to its standard input and reading responses from its standard output.
A TorX adapter can be implemented in any programming language (as long as programs can be written in it that read from standard input and write to standard output, and as long as it is powerful enough to interact with the system under test, and map model labels onto interactions with the system under test an vice versa).
For Java a template TorX adapter program has been made that contains the code for interacting with JTorX, and that has to be extended with code to interact with the system under test (to be linked here soon).

The Protocol

The torx-adapter manual page describes the protocol in more detail. At this moment JTorX only uses the following commands (the manual page contains a much longer list)
  • C_IOKIND
  • C_INPUT
  • C_OUTPUT
  • C_QUIT

The C_INPUT command and the A_INPUT and A_OUTPUT responses have a model label as parameter.
The TorX adapter is responsible for mapping the given model label onto the right interaction stimulus, when asked to apply a stimulus, and for mapping a response from the system under test back to a mode label that can be returned to JTorX.
The TorX adapter must maintain its own queue of pending observations.

Interaction with the System under Test

It is the responsibility of the TorX adapter to make sure that it can communicate with the system under test.
When the system under test has to be started by JTorX, and testing is done by a TorX adapter, then the TorX adapter must start the system under test.
When the system under test is started outside JTorX, the TorX adapter must contain code to connect to (communicate with) the system under test.

Warning

A TorX adapter program must on its standard output only write messages that are described by the torx-adapter protocol
Diagnostics and other messages must be written to standard error.

JTorX Configuration Steps

  1. Enter the path to the specification file in Config Items text field Model
    (or use the Browse button; make sure it shows All supported Formats)
  2. Select implementation type: real program, started via given TorX adapter
    3. Enter Adapter:
    Here the adapter program must be entered that JTorX must start, for example, when the adapter is a java program:
    On windows: java -jar "J:\ex\fwgc\impl\adapter.jar"
    On linux: java -jar "/path/to /ex/fwgc/impl/adapter.jar"
    Note: on windows the double quotes are needed
  3. Choose Timeout value and timeout unit
    (typically 1 or 2 seconds, but this of course depends on your program)
  4. Select the right interpretation for your model
  5. Select traces kind: Straces or Utraces.
  6. Select the Test tab.
  7. Optionally, choose your own random number Seed.
  8. Press the Start button - it will show Stop, and a Log pane will appear.
  9. Use the buttons in the Next test step(s) pane to execute test steps.
  10. Press the Stop button when you are done.
  11. You may want to close the Log panes when you are done.

Notes

  • unfortunately it is not yet possible to specify in JTorX the working directory from which the adapter program must be run.

Back to Usage scenarios