2.2. Master-Slave Approach

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.

It is important to note the difference between a crash and a timeout:

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:

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.