TestCenter Reference
TestSupport.UnitTestDiscovery Namespace Reference

Functions

def getSuiteFromPackage (unitTestRootPackage, pattern='test *.py')
 
def getSuiteFromFolder (searchPath, pattern=' *.py')
 

Function Documentation

◆ getSuiteFromFolder()

def TestSupport.UnitTestDiscovery.getSuiteFromFolder (   searchPath,
  pattern = '*.py' 
)
Creates a Test Suite from all the tests inside a folder, this could be a TestCenter TestCase folder.
:param searchPath: the folder where to search for the unit tests.
:param pattern: Only test files that match the pattern will be loaded.

Definition at line 47 of file UnitTestDiscovery.py.

◆ getSuiteFromPackage()

def TestSupport.UnitTestDiscovery.getSuiteFromPackage (   unitTestRootPackage,
  pattern = 'test*.py' 
)
Creates a Test Suite from all the tests inside a python package which is located in the MeVisLab Repository.

Example usage inside a MeVisLab TestCenter Test:

from TestSupport.UnitTestDiscovery import getSuiteFromPackage
import my_module.core.tests


def UNITTEST_My_Module():
  return getSuiteFromPackage(my_module.core.tests)

:param unitTestRootPackage: the python package in which unit tests are searched
:type unitTestRootPackage: ModuleType
:param pattern: Only test files that match the pattern will be loaded.

More details can be found in the documentation of the TestLoader.discover() function.

Definition at line 15 of file UnitTestDiscovery.py.