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)
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.
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¶
- Enter the path to the specification file in
Config Itemstext field
(or use the
Browsebutton; make sure it shows
All supported Formats)
- Select implementation type:
real program, started via given TorX adapter
Here the adapter program must be entered that JTorX must start, for example, when the adapter is a java program:
java -jar "J:\ex\fwgc\impl\adapter.jar"
java -jar "/path/to /ex/fwgc/impl/adapter.jar"
Note: on windows the double quotes are needed
(typically 1 or 2 seconds, but this of course depends on your program)
- Select the right
interpretationfor your model
- Select traces kind: Straces or Utraces.
- Select the Test tab.
- Optionally, choose your own random number Seed.
- Press the Start button - it will show Stop, and a Log pane will appear.
- Use the buttons in the Next test step(s) pane to execute test steps.
- Press the Stop button when you are done.
- You may want to close the Log panes when you are done.
- 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