Test targets represent entities that QMTest uses to run tests. See Section 3.1.7 for an overview of how QMTest uses targets.
Each target specification includes the following:
The name of the target. This is a name identifying the target, such as the host name of the computer which will run the tests. Target names should be unique in a single target file.
The target class. Similar to a test class, a target class is a Python class which implements a type of target. As with test classes, a target class is identified by its name, which includes the module name and the class name.
For example, thread_target.ThreadTarget is the name of a target class, provided by QMTest, which runs tests in multiple threads on the local computer.
QMTest includes several target class implementations. See Section 3.6.3 for details.
A target group name. The test implementor may choose the syntax of target group names in a test implementation. Target groups may be used to encode information about target attributes, such as architecture and operating system, and capabilities.
A concurrency value, which must be a positive integer. Most target classes support concurrent execution of multiple tests on the target. This number allows the target specification to control how many tests are executed simultaneously.
Optionally, a target specification may include additional properties. Properties are named and have string values. Some target classes may use property information to control their configuration. For instance, a target class which executes tests on a remote computer would extract the network address of the remote computer from a target property.
In a target file, you specify the computers or other test targets on which QMTest runs tests. Use the --targets (-T) option to the qmtest run command to specify the target file.
A target file is an XML document containing elements representing target specifications. The document type is -//Software Carpentry//QMTest Target V0.1//EN, and the document element is targets.
Each target specification is represented by a target element, and includes name, class, group, and concurrency elements. Additional property elements may provide target properties.
For example, the following target file specifies two targets for running tests.
<?xml version='1.0' encoding='ISO-8859-1'?> <!DOCTYPE targets PUBLIC "-//Software Carpentry//QMTest Target V0.1//EN" "http://www.software-carpentry.com/qm/xml/target.dtd"> <targets> <target> <name>local</name> <class>thread_target.ThreadTarget</class> <group>i386-pc-linux-gnu</group> <concurrency>1</concurrency> </target> <target> <name>remote</name> <class>rsh_target.RSHTarget</class> <group>sparc-sun-solaris2.5.1</group> <concurrency>2</concurrency> <property name="host">sunshine</property> <property name="arguments">-l test</property> </target> </targets>
The first target is the local GNU/Linux computer. The second target is a remote computer running SPARC Solaris. QMTest invokes tests on the remote target using a remote shell invocation. The remote computer's name is "sunshine", and two tests are run concurrently on that target.
QMTest includes these target class implementations.
The thread_target.ThreadTarget target class runs tests in one or more threads on the local computer (the computer on which the qmtest command is invoked). The number of threads is the degree of concurrency specified for the target.
The rsh_target.RSHTarget target class runs tests on a remote computer via a remote shell invocation (rsh, ssh, or similar). This target uses a remote shell to invoke a program similar to the qmtest command on the remote computer. This remote program accepts test commands and responds with results from running these tests.
To use RSHTarget, the remote computer must have QMTest installed and must contain an identical copy of the test database. QMTest does not transfer entire tests over the remote shell connection; instead, it relies on the remote test database for loading tests.
In addition, the remote shell program must be configured to allow a remote login without additional intervention (such as typing a password). If you use rsh, you can use an .rhosts file to set this up. If you use ssh, you can use an SSH public key and the ssh-agent program for this. See the corresponding manual pages for details.
The concurrency value of the target specification controls the number tests that may be run concurrently on the remote host.
The RSHTarget target class takes its configuration from the following target properties:
The remote_shell property specifies the path to the remote shell program. If omitted, the configuration variable remote_shell is used instead. If neither is specified, the default is /usr/bin/ssh. The remote shell program must accept the same command-line syntax as rsh.
The host property specifies the remote host name. If omitted, the target name is used.
The database_path property specifies the path to the test database on the remote computer. The test database must be identical to the local test database. If omitted, the local test database path is used.
The arguments property specifies additional command-line arguments for the remote shell program. The value of this property is split at space characters, and the arguments are added to the command line before the name of the remote host.
For example, if you are using the ssh remote shell program and wish to log in to the remote computer using a different user account, specify the -l username option using the arguments property.
QMTest uses the remote shell to invoke the qmtest_remote program on the remote host. This program is installed by default in /usr/local/bin/qmtest. You may override this and use a version in a different place by specifying the qmtest_remote property.