3.2. Local Testing from the Command Line

The file TestCenter.py is used as the script file for the hidden TestCenter module. This module is loaded via the runmacro option of the MeVisLab executable and takes care of loading the slave, which then connects to the master. You may start it with a batch file containing the following command, where %MLAB_ROOT% is an environment variable set by the MeVisLab installation process. Use $MLAB_ROOT on Unix-based systems: "%MLAB_ROOT%\MeVis\ThirdParty\Python\MeVisPython.exe" "%MLAB_ROOT%\MeVisLab\Standard\Modules\Macros\Tests\TestCenterAdvanced\TestCenter.py"

TestCenter.py can also be used from the command line, in which case it is used as a standalone Python script file. It offers many helpful options to specify the tests to be executed (see Table 3.1, “TestCenter Command Line Options”).

Table 3.1. TestCenter Command Line Options

Option Description
-h Shows help on all available options.
-v Runs in verbose mode, i.e., shows more messages.
-d Runs in debug mode, i.e., shows even more messages than in verbose mode.
-j Creates one report file for each test case. The test case name is used as a filename. The report format is JUnit-like (see TestCaseManager help for details).
-J Writes all test case results to one JUnit file named junitOutput.xml. The report format is JUnit, which can be used in Jenkins (see TestCaseManager help for details).
-n Processes no results.
-N Creates no report consisting of static HTML pages.
-D Specifies a custom report directory.
-r Collapses all functions on test case pages in the created report.
-R Shows only failed test functions on test case pages in the created report.
-c Uses the given file instead of the default for configuration.
-l Saves logging messages to the given file.
-t Specifies a comma-separated list of test cases and functions to execute, e.g., -t test1, test2[func1;func2], test3. By default, all available tests are executed.
-T Specifies a comma-separated list of test suites, e.g., -T testSuite1, testSuite2, testSuite3.
-i Specifies a comma-separated list of test names to ignore.
-g Specifies a comma-separated list of test groups to use. This is used to run test cases only for the given group. The group “automatic” is special in that all test cases not being part of the “manual” group are automatically in this group. If a test group name is prepended with a '!', all test cases with the given group are excluded from testing instead.
-p Specifies a list of packages used for testing. Modules and test cases are taken from the given set of packages. By default, all available packages are taken into account.
-P Specifies a list of additional packages that should be set to be available. The list of available packages is required by some tests to decide whether modules are available or not. For example, the published packages should not contain example networks that rely on modules from internal packages.
[Note] Note

This list always contains at least the tested packages!

-m Specifies a comma-separated list of modules used for generic tests.
-f Specifies a comma-separated list of filters for the list of modules. Each filter is of the form key=value where the keys are taken from modules' information. If it contains the given value, the module will be tested. For example, this allows to run all test cases whose author contains the substring “JDoe”.
-X Specifies a floating-point value that is multiplied with the normal timeout value for each test. This is intended to compensate for external factors that slow down test execution. The same effect can be achieved by setting the environment variable MLAB_TEST_TIMEOUT_FACTOR to a floating-point value. (The environment variable also works when starting tests directly from MeVisLab.)

[Note] Note

This command opens a socket to communicate with the client instances of MeVisLab that actually execute the tests (this also applies to the TestCaseManager when used in Secure testing mode). By default, the port number is 21319. If this clashes with any other applications on the computer, you can set the environment variable MeVisLabTestCenterPort to change the port number.

The command line interface is useful for automated tests that cover a special subset of test cases (e.g., all test cases of a test group), modules (e.g., all modules related to one author), the TestCenter itself, or associated tools.