Chapter 16. Using the TestCenter

Table of Contents

16.1. Introduction to Testing in MeVisLab
16.2. Developing a Test Case
16.2.1. Creating a New Test Case
16.2.2. Populating the Test Network
16.2.3. Editing the Module Settings
16.2.4. Creating a First Test Script with Manual Threshold Setting
16.2.5. Automating the Test Case with the FieldValueTestCaseEditor
16.2.6. Automating the Test Case with an Iterative Test
16.2.7. Grouping Test Functions
16.2.8. Enhancing Test Reports with ScreenShots
16.2.9. Disabling Test Functions

In the following chapter, we will introduce you to using the MeVisLab TestCenter.

16.1. Introduction to Testing in MeVisLab

[Note]Note

In the following section, we only have a brief look at the concepts of the TestCenter. For detailed information and references, see the TestCenter Reference and the TestCenter Manual.

The testing of macro modules, networks, applications and scriptable functionality in MeVisLab is done with the TestCenter.

[Tip]Tip

On the C++ level, GoogleTest can be used.

What makes a test? Possible definitions:

  • A test compares results against expectations.

  • A test uses a parameterized algorithm to generate data that is compared to expected results.

  • A test is a specification that can easily be verified.

Two main categories of test cases can be created with the TestCenter:

  • Generic test cases: Tests a larger set of modules by applying a test case generically.

  • Functional test cases: Tests specific functionalities of a single module or network.

A test case in MeVisLab consists of

  • a set of test functions

  • input data

  • (optional) a network

[Tip]Tip

A network provides the context for a module to be tested, such as inputs/outputs/other modules for comparison. A network might be unnecessary for testing scripting functionality only, but might still be useful if you want to add a module, connect it to another module, and then remove again, etc.

TestCases are similar to macro modules, with two differences:

  • They are not handled by the general module database but by a specific test case database, the MLABTestCaseDatabase.

  • The TestCase database must be initialized explicitly.

TestCases are located in the TestCases directories of the packages, parallel to the folders “Modules” and “Sources”.

The test case creation and management is supported by the special macro module (TestCaseManager) which is implemented in the MeVisLab GUI and will be used in our example.

[Note]Note

Test cases cannot be deleted in the TestCaseManager. To delete a test case, delete the folder of the test case on your system and click Reload All in the TestCaseManager.

The name of a test function consists of three parts:

  • One of the following predefined keywords to define the test type:

    • TEST: a function that is executed once.

    • FIELDVALUETEST: a test based on interactively predefined settings of fields and comparison of computed field values with expected results.

    • ITERATIVETEST: a test based on a list of given parameter and a function that is executed for each parameter.

  • An arbitrary string used for sorting.

  • An arbitrary name of the function for display purposes.