TestCenter Reference
|
Classes | |
class | MeVisLabTestCase |
Functions | |
skippedDummyTest (_) | |
addTestsToMeVisLabTestCase (globals) | |
writeTestCenterConfigFile (configFilename, executablePath='', resultDirectory='', reportDirectory='') | |
_getEnvironmentForTestCenter (mlabroot) | |
_stripTags (s) | |
Variables | |
mlabroot = os.environ.get('MLAB_ROOT') | |
NormalTestRegExp = re.compile(r'^(?:DISABLED_)?TEST(\d*_\w+)$') | |
IterativeTestRegExp = re.compile(r'^(?:DISABLED_)?ITERATIVETEST(\d*_\w+)$') | |
_stripTagsRE = re.compile(r'(<!--.*?-->|<[^>]*>)') | |
Tools for running MeVisLab tests as Python unit tests The functions, decorators and classes defined in this module allow you to wrap your MeVisLab FunctionalTestCase in a unittest.TestCase so that the test case can be executed using the standard Python unit testing framework. To wrap a FunctionalTestCase in a unittest.TestCase add the following at the end of the test case file. from TestSupport import PythonUnitTest @PythonUnitTest.addTestsToMeVisLabTestCase(globals()) class NameOfFunctionalTestCase(PythonUnitTest.MeVisLabTestCase): pass @note: NameOfFunctionalTestCase has to be identical with the name of the FunctionalTestCase specified in the .def file. Otherwise, the MeVisLab TestCenter that is used to execute the tests will not find the tests. The above is sufficient to allow PyCharm(TM) to run your MeVisLab functional tests as any other Python unit tests. If you also want to run your tests from the command line, then, additionally, add the following at the end of the file with the MeVisLab tests (just as for any old Python unit test). if __name__ == '__main__': import unittest unittest.main() @note: Wrapping ITERATIVETEST functions only works if the generation of the test dictionary returned by the ITERATIVETEST function does not require functionality that only works if the test runs in MeVisLab. For example, TestSupport.Base.getDataDirectory() cannot be used in ITERATIVETEST. Instead you can use something like if __file__: # use __file__ if running outside of MeVisLab (where Base.getDataDirectory() doesn't work) dataDirectory = os.path.join(os.path.dirname(__file__), 'Data') else: # use Base.getDataDirectory() if running in MeVisLab (where __file__ is not set) dataDirectory = Base.getDataDirectory()
|
protected |
Definition at line 235 of file PythonUnitTest.py.
Referenced by TestSupport.PythonUnitTest.MeVisLabTestCase.setUpClass().
|
protected |
Strips HTML tags from the given string. Warning: This function is not fool-proof. It is only meant to handle well-formed HTML in MeVisLab log messages.
Definition at line 265 of file PythonUnitTest.py.
Referenced by TestSupport.PythonUnitTest.MeVisLabTestCase.createRunTestMethod().
TestSupport.PythonUnitTest.addTestsToMeVisLabTestCase | ( | globals | ) |
Definition at line 78 of file PythonUnitTest.py.
TestSupport.PythonUnitTest.skippedDummyTest | ( | _ | ) |
Definition at line 70 of file PythonUnitTest.py.
TestSupport.PythonUnitTest.writeTestCenterConfigFile | ( | configFilename, | |
executablePath = '', | |||
resultDirectory = '', | |||
reportDirectory = '' ) |
Definition at line 223 of file PythonUnitTest.py.
Referenced by TestSupport.PythonUnitTest.MeVisLabTestCase.setUpClass().
|
protected |
Definition at line 263 of file PythonUnitTest.py.
TestSupport.PythonUnitTest.IterativeTestRegExp = re.compile(r'^(?:DISABLED_)?ITERATIVETEST(\d*_\w+)$') |
Definition at line 75 of file PythonUnitTest.py.
TestSupport.PythonUnitTest.mlabroot = os.environ.get('MLAB_ROOT') |
Definition at line 66 of file PythonUnitTest.py.
TestSupport.PythonUnitTest.NormalTestRegExp = re.compile(r'^(?:DISABLED_)?TEST(\d*_\w+)$') |
Definition at line 74 of file PythonUnitTest.py.