As automatic testing should work without interruption, even in cases of crashes or infinite loops, a separate MeVisLab instance is run to execute the tests. This setup is commonly referred to as a master-slave approach.
The master can be started via MeVisLab, the TestCenter Coordinator, or the command line.
The slave is a MeVisLab instance that automatically loads the TestCenter macro module and is controlled by the master so that it can be interrupted and restarted if necessary.
It is important to note the difference between a crash and a timeout:
If the slave process crashes, the master detects this and reacts
appropriately. As the crash could be due to a side effect of a previous test case or function,
the master retries the crashed test function once. Afterward, the remaining test functions
are called (with consideration of the timeout value). After each restart, the
setUpTestCase
method is called for the test case.
The timeout is a value given in the test case definition or defaults to 20 seconds. It specifies the time after which the test case should have finished; otherwise, the master assumes the slave was trapped in an infinite loop. The solution to this situation is to restart the slave process and proceed to the next test case. No retry is attempted, as the timeout value may be very large and this would lengthen the test process enormously.
One of the main problems with the master-slave approach is that it requires some sort of communication between the two entities. This is solved by using asynchronous, socket-based communication. It has the benefit that crash and timeout detection come for free when using non-blocking communication. Each operation is coupled with a timeout so that a failure will not block the session.
Basic Description of the Socket Implementation
The message length must be known to the receiver so that it can detect the end of the transmission. Therefore, at least two messages are sent. The first message is of fixed length (16 bytes) and contains the right-aligned length of the string that is sent as the second message. This string is sent split into blocks of a maximum size of 8192 bytes.
This low-level protocol is used to send commands encapsulated in XML nodes between the master and the slave. The command type is specified as a type attribute in an XML node, with parameters given as subnodes. The slave processes the command and returns an XML node as a response, containing a status and the results.
The following list provides all commands and their supported parameters:
Quit: Makes the slave terminate itself. Requires no parameters.
DoTest: Instructs the slave to execute a given test case. A subnode with the tag “TestCase” is given, which contains information about the current test case (name and type of test case, and the module to be tested in the case of a generic test case), and the list of test functions that need to be run.
SetPackageList: Contains a subnode with the tag “Packages” with information about all packages that are assumed to be available. This is required for some tests that must decide whether certain modules are available by taking into account only the specified packages.
BuildTestAgenda: As the master
must not run inside MeVisLab, the slave must gather which test cases
and modules are to be taken into account. The master sends the
request with a subnode with the tag “Configuration” that contains
information about the settings for the current test run. This
includes information about preselected packages, test cases, and
modules, for example. The slave returns a list of XML nodes that
contain the test case information used when sending the
DoTest
command.
For local testing (see Section 3.1, “Local Testing from Within MeVisLab”), it is possible to run test cases in the actual MeVisLab instance. In that case, the slave Python script is imported, and function calls are used instead of the socket-based communication.
© 2026 MeVis Medical Solutions AG