TestCenter Reference
TestCenterAdvanced.Master.Master Class Reference

The coordinator of test execution. More...

Public Member Functions

 __init__ (self, cfgFile=None, verbose=False, slave=None, slaveEnvironment=None, isInsideTestCaseManager=False)
 Initialize the master process.
 onExit (self)
 __enter__ (self)
 __exit__ (self, *_)
 __del__ (self)
 stop (self)
 shouldStop (self)
 getTestProgress (self)
 resetTestProgress (self, testCaseCount)
 updateTestProgress (self, finishedTestCase=None, additionalTestCaseCount=None)
 setUpdateProgressFunc (self, updateProgressFunc)
 setActiveTestCase (self, testCase)
 setTestCaseListener (self, listener)
 setTestCases (self, testCaseList)
 Set the list of test cases to execute.
 setTestCasesToIgnore (self, testCaseToIgnoreList)
 Set the list of test cases to ignore.
 setTestGroups (self, testGroupList)
 Set the list of test groups to take into account.
 setTestSuites (self, testSuiteList)
 setModules (self, moduleList=None, filterList=None)
 Specify the list of modules to test.
 setPackages (self, testedPkgList=None, availablePkgList=None, ignoredPkgList=None)
 Specify the packages that should be tested and thought available.
 setTestTimeoutFactor (self, float factor)
 shouldMeasurePythonCoverageGlobally (self)
 run (self, funcDict=None, stopSlaveAfterTestRun=True)
 The main method which handles all the request from the master.
 reset (self)
 Resets the master to the state after instantiation.
 getConfig (self)
 logMessageWithPID (self, message)
 logDebugWithPID (self, message)
 logErrorWithPID (self, message)
 logMessageWithLastError (self, message)
 stopSlave (self)
 Stop the slave process.

Static Public Member Functions

 defaultTestTimeoutFactor ()
 transferNodeFromExecutionToResultXML (nodeName, executionNode, testResultNode)

Public Attributes

 logfileDir = os.path.join(resultDir, "logfiles")

Detailed Description

The coordinator of test execution.

The master can be used in two ways: either with tests executed in another MeVisLab instance or in the same. In the first scenario a new MeVisLab instance is started, the TestCenter module loaded via the runMacro parameter and communication handled using socket based interprocess communication. In the second one the slave is instantiated directly in the master.

Definition at line 209 of file Master.py.

Constructor & Destructor Documentation

◆ __init__()

TestCenterAdvanced.Master.Master.__init__ ( self,
cfgFile = None,
verbose = False,
slave = None,
slaveEnvironment = None,
isInsideTestCaseManager = False )

Initialize the master process.

Parameters
cfgFileThe configuration file to load (defaults to tc_cfg_<platform>.xml)
verboseUnused
slaveRun the tests in the same MeVisLab instance using the given slave instance.
slaveEnvironmentEnvironment to use for the MeVisLab slave instance.

Definition at line 218 of file Master.py.

References __com, __config, __hangingSlaves, __lock, __logger, TestCenterAdvanced.Master.SlaveProcess.__logger, __shouldStop, __slave, __slaveEnvironment, __slaveProc, __testCaseListener, __testCasesToIgnoreList, __testedPkgList, __testProgress, and __xmlRoot.

◆ __del__()

TestCenterAdvanced.Master.Master.__del__ ( self)

Definition at line 302 of file Master.py.

References onExit().

Member Function Documentation

◆ __enter__()

TestCenterAdvanced.Master.Master.__enter__ ( self)

Definition at line 296 of file Master.py.

◆ __exit__()

TestCenterAdvanced.Master.Master.__exit__ ( self,
* _ )

Definition at line 299 of file Master.py.

References onExit().

◆ defaultTestTimeoutFactor()

TestCenterAdvanced.Master.Master.defaultTestTimeoutFactor ( )
static

Definition at line 468 of file Master.py.

◆ getConfig()

TestCenterAdvanced.Master.Master.getConfig ( self)

Definition at line 1146 of file Master.py.

References __config, __isSlaveRunning(), and __slaveProc.

◆ getTestProgress()

TestCenterAdvanced.Master.Master.getTestProgress ( self)

Definition at line 316 of file Master.py.

References __lock, and __testProgress.

◆ logDebugWithPID()

TestCenterAdvanced.Master.Master.logDebugWithPID ( self,
message )

◆ logErrorWithPID()

TestCenterAdvanced.Master.Master.logErrorWithPID ( self,
message )

◆ logMessageWithLastError()

◆ logMessageWithPID()

TestCenterAdvanced.Master.Master.logMessageWithPID ( self,
message )

Definition at line 1155 of file Master.py.

References __slaveProc.

Referenced by logDebugWithPID(), and logErrorWithPID().

◆ onExit()

TestCenterAdvanced.Master.Master.onExit ( self)

Definition at line 289 of file Master.py.

References __hangingSlaves, __logger, and TestCenterAdvanced.Master.SlaveProcess.__logger.

Referenced by __del__(), and __exit__().

◆ reset()

TestCenterAdvanced.Master.Master.reset ( self)

Resets the master to the state after instantiation.

In particular, it removes the configuration and the results of the last test run. After resetting the master you can start another test run with other tests.

Definition at line 1138 of file Master.py.

References __testCfg, __testConfigSkeleton(), and __xmlRoot.

Referenced by resetTestProgress().

◆ resetTestProgress()

TestCenterAdvanced.Master.Master.resetTestProgress ( self,
testCaseCount )

Definition at line 322 of file Master.py.

References __lock, __testProgress, and reset().

Referenced by run().

◆ run()

TestCenterAdvanced.Master.Master.run ( self,
funcDict = None,
stopSlaveAfterTestRun = True )

The main method which handles all the request from the master.

The master asks the slave to serve some request. This is divided into two major blocks; on the first hand verifying whether the given information is valid and what tests to execute and on the second hand to process the given tests.

Parameters
funcDictA dictionary with information which test functions for which test cases should be executed.
stopSlaveAfterTestRunIf False, then the slave can be re-used for another test run after resetting the master.

Definition at line 972 of file Master.py.

References __buildTestAgenda(), __config, __doTest(), __handleExtraTestCaseResults(), __logger, TestCenterAdvanced.Master.SlaveProcess.__logger, __slave, __slaveProc, __sortNodes(), __startSlave(), __testCaseListener, __testTypeAndName(), __updateProgressFunc, __xmlRoot, resetTestProgress(), setActiveTestCase(), shouldMeasurePythonCoverageGlobally(), stopSlave(), and updateTestProgress().

◆ setActiveTestCase()

TestCenterAdvanced.Master.Master.setActiveTestCase ( self,
testCase )

Definition at line 362 of file Master.py.

References __lock, and __testProgress.

Referenced by run().

◆ setModules()

TestCenterAdvanced.Master.Master.setModules ( self,
moduleList = None,
filterList = None )

Specify the list of modules to test.

The filters can be used to specify a larger list of modules, for example all the modules of a certain author ("author:Jon Doe").

Parameters
moduleListList of names of modules to take into account.
filterListList of filters to select modules.

Definition at line 419 of file Master.py.

References __testCfg, and __xmlRoot.

◆ setPackages()

TestCenterAdvanced.Master.Master.setPackages ( self,
testedPkgList = None,
availablePkgList = None,
ignoredPkgList = None )

Specify the packages that should be tested and thought available.

The packages tested are those that test cases are taken from. The available packages are those that should be expected to be there. This is important for checking the meta information like the seeAlso tags. In released installers all seeAlso links should only point to modules being the public packages.

Parameters
testedPkgListThe list of packages tests are taken from.
availablePkgListList of packages that should be available.
ignoredPkgListList of package that should be ignored when using wildcard.

Definition at line 437 of file Master.py.

References __testCfg, __testedPkgList, and __xmlRoot.

◆ setTestCaseListener()

TestCenterAdvanced.Master.Master.setTestCaseListener ( self,
listener )

Definition at line 386 of file Master.py.

References __testCaseListener.

Referenced by TestCenterAdvanced.Slave.Slave.runCommand().

◆ setTestCases()

TestCenterAdvanced.Master.Master.setTestCases ( self,
testCaseList )

Set the list of test cases to execute.

Parameters
testCaseListList of names of test cases to execute.

Definition at line 389 of file Master.py.

References __testCfg, and __xmlRoot.

◆ setTestCasesToIgnore()

TestCenterAdvanced.Master.Master.setTestCasesToIgnore ( self,
testCaseToIgnoreList )

Set the list of test cases to ignore.

Definition at line 400 of file Master.py.

References __testCasesToIgnoreList.

◆ setTestGroups()

TestCenterAdvanced.Master.Master.setTestGroups ( self,
testGroupList )

Set the list of test groups to take into account.

Definition at line 404 of file Master.py.

References __testCfg, and __xmlRoot.

◆ setTestSuites()

TestCenterAdvanced.Master.Master.setTestSuites ( self,
testSuiteList )

Definition at line 412 of file Master.py.

References __testCfg, and __xmlRoot.

◆ setTestTimeoutFactor()

◆ setUpdateProgressFunc()

TestCenterAdvanced.Master.Master.setUpdateProgressFunc ( self,
updateProgressFunc )

Definition at line 359 of file Master.py.

References __updateProgressFunc.

◆ shouldMeasurePythonCoverageGlobally()

TestCenterAdvanced.Master.Master.shouldMeasurePythonCoverageGlobally ( self)

Definition at line 969 of file Master.py.

References __config.

Referenced by run().

◆ shouldStop()

TestCenterAdvanced.Master.Master.shouldStop ( self)

Definition at line 310 of file Master.py.

References __lock, and __shouldStop.

Referenced by transferNodeFromExecutionToResultXML().

◆ stop()

TestCenterAdvanced.Master.Master.stop ( self)

Definition at line 305 of file Master.py.

References __lock, and __shouldStop.

◆ stopSlave()

TestCenterAdvanced.Master.Master.stopSlave ( self)

Stop the slave process.

If the slave is running this method tries to stop the slave. This method will run until the slave has stopped. After 3 tries on unix a KILL signal is sent.

Returns
True if the slave was stopped.

Definition at line 1231 of file Master.py.

References __com, __config, __hangingSlaves, __isSlaveStopped(), __logger, TestCenterAdvanced.Master.SlaveProcess.__logger, __sendRequest(), __slave, __slaveProc, __stackTraceFile, __startSlave(), __testCaseListener, logDebugWithPID(), TestCenterAdvanced.Master.SlaveProcess.logDebugWithPID(), logErrorWithPID(), and TestCenterAdvanced.Master.SlaveProcess.logErrorWithPID().

Referenced by logMessageWithLastError(), run(), and transferNodeFromExecutionToResultXML().

◆ transferNodeFromExecutionToResultXML()

TestCenterAdvanced.Master.Master.transferNodeFromExecutionToResultXML ( nodeName,
executionNode,
testResultNode )
static

◆ updateTestProgress()

TestCenterAdvanced.Master.Master.updateTestProgress ( self,
finishedTestCase = None,
additionalTestCaseCount = None )

Definition at line 327 of file Master.py.

References __lock, and __testProgress.

Referenced by run().

Member Data Documentation

◆ logfileDir

TestCenterAdvanced.Master.Master.logfileDir = os.path.join(resultDir, "logfiles")

Definition at line 257 of file Master.py.

Referenced by logMessageWithLastError().


The documentation for this class was generated from the following file:
  • MeVisLab/Standard/Modules/Macros/Tests/TestCenterAdvanced/Master.py