TestCenter Reference
TestSupport.TestHelper.TestHelper Class Reference

Singleton for important helper facilities for the different tests. More...

Public Member Functions

 __new__ (self, *args, **kargs)
 The new method.
 
 __init__ (self, *args, **kargs)
 The default constructor.
 
 getInstance (self, *args, **kargs)
 The default constructor.
 
 hasInstance (self)
 Check if an instance has been initialized.
 
 setPackageList (self, packageList)
 Set the list of available packages.
 
 getPackageList (self)
 Return the list of available packages.
 
 getGlobalContext (self)
 
 setTestCaseContext (self, ctx)
 Set the context of the test.
 
 setMacrosLogOnSuccess (self, macrosLogOnSuccess)
 
 getMacrosLogOnSuccess (self)
 
 getTestCaseContext (self)
 Get the context of the test.
 
 getHelperContext (self)
 
 getResultDirectory (self)
 
 setModuleName (self, moduleName)
 
 getModuleName (self)
 
 setTestCaseName (self, testCaseName)
 
 getTestCaseName (self)
 
 setTestCaseDataDirectory (self, testCaseDataPath)
 
 getTestCaseDataDirectory (self)
 
 setTestCaseResultDirectory (self, testCaseName, functionName)
 
 getTestCaseResultDirectory (self)
 
 pushChangeSet (self)
 Push a new ChangeSet to the stack.
 
 popChangeSet (self)
 Pop a ChangeSet from the stack and delete it.
 
 clearChangeSet (self)
 Clear the change set stakc without restoring the field values.
 
 getChangeSet (self)
 Return the ChangeSet on top of the stack.
 
 getChangeSetStackLength (self)
 Get the length of the ChangeSet stack.
 
 setLogHandler (self, logHandler)
 Set the current log handler.
 
 unsetLogHandler (self)
 Unset the current log handler.
 
 getLogHandler (self)
 Get the current log handler.
 
 setCallerStackFrame (self, stackFrame)
 
 getCallerStackFrame (self)
 
 hasCallerStackFrame (self)
 
 resetCallerStackFrame (self)
 
 addExtraTestCaseResult (self, extraTestCaseResult)
 
 takeExtraTestCaseResults (self)
 
 pushEnvironment (self)
 Pushes the current environment to the stack.
 
 popEnvironment (self)
 Pops an environment dictionary from the stack and makes it the current environment.
 

Protected Attributes

 _mChangeSet
 
 _mMacrosLogOnSuccess
 

Static Protected Attributes

 _mCtx = None
 The global context.
 
 _mTestCaseContext = None
 The current test's context.
 
 _mHelperModule = None
 The context of the helper module.
 
 _mResultDirectory = None
 The directory used to save results.
 
 _mPackageList = None
 The list of packages that should be assumed to be available.
 
 _mTestCaseName = None
 The name of the current test case.
 
 _mModuleName = None
 The name of the currently tested module.
 
 _mTestCaseDataDirectory = None
 The path to the test case data.
 
 _mTestCaseResultDirectory = None
 The path to the results.
 
 _mChangeSetStack = None
 A stack of ChangeSets used to revert changes to field values.
 
 _mLogHandler = None
 The log handler that can be used to handle the reports.
 
 _mStackFrame = None
 The stack frame of the calling function that is used when logging events.
 
 _mEnvironmentStack = None
 A stack of environment dictionaries used to revert changes to the environment.
 
 _mExtraTestCaseResults = None
 A list of extra test case results.
 
bool _mMacrosLogOnSuccess = True
 This is the default value for the 'logOnSuccess' parameter (if it is None) of the ASSERT_*/EXPECT_* macros.
 

Detailed Description

Singleton for important helper facilities for the different tests.

Warning
Please note: This is internal stuff and should not be used in tests! The functionality is provided through the TestSupport package.

Definition at line 265 of file TestHelper.py.

Constructor & Destructor Documentation

◆ __init__()

TestSupport.TestHelper.TestHelper.__init__ ( self,
* args,
** kargs )

The default constructor.

Do nothing in here as construction must be done in the getInstance methode.

Definition at line 322 of file TestHelper.py.

Member Function Documentation

◆ __new__()

TestSupport.TestHelper.TestHelper.__new__ ( self,
* args,
** kargs )

The new method.

Definition at line 314 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper.getInstance().

◆ addExtraTestCaseResult()

TestSupport.TestHelper.TestHelper.addExtraTestCaseResult ( self,
extraTestCaseResult )

◆ clearChangeSet()

TestSupport.TestHelper.TestHelper.clearChangeSet ( self)

Clear the change set stakc without restoring the field values.

Definition at line 491 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mChangeSetStack, and TestSupport.TestHelper.TestHelper.popChangeSet().

◆ getCallerStackFrame()

TestSupport.TestHelper.TestHelper.getCallerStackFrame ( self)

Definition at line 538 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mStackFrame.

◆ getChangeSet()

TestSupport.TestHelper.TestHelper.getChangeSet ( self)

Return the ChangeSet on top of the stack.

Definition at line 500 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mChangeSetStack.

◆ getChangeSetStackLength()

TestSupport.TestHelper.TestHelper.getChangeSetStackLength ( self)

Get the length of the ChangeSet stack.

Returns
Length of the stack.

Definition at line 510 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mChangeSetStack.

◆ getGlobalContext()

TestSupport.TestHelper.TestHelper.getGlobalContext ( self)

Definition at line 385 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mCtx.

◆ getHelperContext()

TestSupport.TestHelper.TestHelper.getHelperContext ( self)

Definition at line 414 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mHelperModule.

◆ getInstance()

◆ getLogHandler()

TestSupport.TestHelper.TestHelper.getLogHandler ( self)

Get the current log handler.

This returns None if no log handler is set!

Returns
The current log handler.

Definition at line 531 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mLogHandler.

◆ getMacrosLogOnSuccess()

TestSupport.TestHelper.TestHelper.getMacrosLogOnSuccess ( self)

◆ getModuleName()

TestSupport.TestHelper.TestHelper.getModuleName ( self)

Definition at line 429 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mModuleName.

◆ getPackageList()

TestSupport.TestHelper.TestHelper.getPackageList ( self)

Return the list of available packages.

Definition at line 380 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mPackageList.

◆ getResultDirectory()

TestSupport.TestHelper.TestHelper.getResultDirectory ( self)

◆ getTestCaseContext()

TestSupport.TestHelper.TestHelper.getTestCaseContext ( self)

Get the context of the test.

Definition at line 409 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mTestCaseContext.

◆ getTestCaseDataDirectory()

TestSupport.TestHelper.TestHelper.getTestCaseDataDirectory ( self)

◆ getTestCaseName()

TestSupport.TestHelper.TestHelper.getTestCaseName ( self)

Definition at line 439 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mTestCaseName.

◆ getTestCaseResultDirectory()

TestSupport.TestHelper.TestHelper.getTestCaseResultDirectory ( self)

◆ hasCallerStackFrame()

TestSupport.TestHelper.TestHelper.hasCallerStackFrame ( self)

Definition at line 541 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mStackFrame.

◆ hasInstance()

TestSupport.TestHelper.TestHelper.hasInstance ( self)

Check if an instance has been initialized.

Definition at line 368 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper.__instance.

◆ popChangeSet()

TestSupport.TestHelper.TestHelper.popChangeSet ( self)

Pop a ChangeSet from the stack and delete it.

Deleting a ChangeSet will revert the changes.

Returns
True if deleting the ChangeSet succeeded.

Definition at line 479 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mChangeSetStack.

Referenced by TestSupport.TestHelper.TestHelper.clearChangeSet().

◆ popEnvironment()

TestSupport.TestHelper.TestHelper.popEnvironment ( self)

Pops an environment dictionary from the stack and makes it the current environment.

Returns
True if an environment dictionary was removed from the stack.

Definition at line 569 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mEnvironmentStack.

◆ pushChangeSet()

TestSupport.TestHelper.TestHelper.pushChangeSet ( self)

Push a new ChangeSet to the stack.

Returns
The length of the ChangeSet stack.

Definition at line 470 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mChangeSetStack, and TestSupport.TestHelper.TestHelper._mTestCaseContext.

◆ pushEnvironment()

TestSupport.TestHelper.TestHelper.pushEnvironment ( self)

Pushes the current environment to the stack.

Definition at line 561 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mEnvironmentStack.

◆ resetCallerStackFrame()

TestSupport.TestHelper.TestHelper.resetCallerStackFrame ( self)

Definition at line 544 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mStackFrame.

◆ setCallerStackFrame()

TestSupport.TestHelper.TestHelper.setCallerStackFrame ( self,
stackFrame )

Definition at line 535 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mStackFrame.

◆ setLogHandler()

TestSupport.TestHelper.TestHelper.setLogHandler ( self,
logHandler )

Set the current log handler.

@params logHandler The current log handler.

Definition at line 517 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mLogHandler.

◆ setMacrosLogOnSuccess()

TestSupport.TestHelper.TestHelper.setMacrosLogOnSuccess ( self,
macrosLogOnSuccess )

Definition at line 398 of file TestHelper.py.

◆ setModuleName()

TestSupport.TestHelper.TestHelper.setModuleName ( self,
moduleName )

Definition at line 424 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mModuleName.

◆ setPackageList()

TestSupport.TestHelper.TestHelper.setPackageList ( self,
packageList )

Set the list of available packages.

Definition at line 374 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mPackageList.

◆ setTestCaseContext()

TestSupport.TestHelper.TestHelper.setTestCaseContext ( self,
ctx )

Set the context of the test.

Definition at line 391 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mTestCaseContext.

◆ setTestCaseDataDirectory()

TestSupport.TestHelper.TestHelper.setTestCaseDataDirectory ( self,
testCaseDataPath )

◆ setTestCaseName()

TestSupport.TestHelper.TestHelper.setTestCaseName ( self,
testCaseName )

Definition at line 434 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mTestCaseName.

◆ setTestCaseResultDirectory()

TestSupport.TestHelper.TestHelper.setTestCaseResultDirectory ( self,
testCaseName,
functionName )

◆ takeExtraTestCaseResults()

TestSupport.TestHelper.TestHelper.takeExtraTestCaseResults ( self)

◆ unsetLogHandler()

TestSupport.TestHelper.TestHelper.unsetLogHandler ( self)

Unset the current log handler.

Definition at line 523 of file TestHelper.py.

References TestSupport.TestHelper.TestHelper._mLogHandler.

Member Data Documentation

◆ _mChangeSet

TestSupport.TestHelper.TestHelper._mChangeSet
protected

Definition at line 393 of file TestHelper.py.

◆ _mChangeSetStack

◆ _mCtx

TestSupport.TestHelper.TestHelper._mCtx = None
staticprotected

◆ _mEnvironmentStack

TestSupport.TestHelper.TestHelper._mEnvironmentStack = None
staticprotected

A stack of environment dictionaries used to revert changes to the environment.

Definition at line 298 of file TestHelper.py.

Referenced by TestSupport.TestHelper.TestHelper.getInstance(), TestSupport.TestHelper.TestHelper.popEnvironment(), and TestSupport.TestHelper.TestHelper.pushEnvironment().

◆ _mExtraTestCaseResults

TestSupport.TestHelper.TestHelper._mExtraTestCaseResults = None
staticprotected

◆ _mHelperModule

TestSupport.TestHelper.TestHelper._mHelperModule = None
staticprotected

The context of the helper module.

Definition at line 272 of file TestHelper.py.

Referenced by TestSupport.TestHelper.TestHelper.getHelperContext(), and TestSupport.TestHelper.TestHelper.getInstance().

◆ _mLogHandler

TestSupport.TestHelper.TestHelper._mLogHandler = None
staticprotected

The log handler that can be used to handle the reports.

Definition at line 292 of file TestHelper.py.

Referenced by TestSupport.TestHelper.TestHelper.getLogHandler(), TestSupport.TestHelper.TestHelper.setLogHandler(), and TestSupport.TestHelper.TestHelper.unsetLogHandler().

◆ _mMacrosLogOnSuccess [1/2]

bool TestSupport.TestHelper.TestHelper._mMacrosLogOnSuccess = True
staticprotected

This is the default value for the 'logOnSuccess' parameter (if it is None) of the ASSERT_*/EXPECT_* macros.

Definition at line 304 of file TestHelper.py.

Referenced by TestSupport.TestHelper.TestHelper.getMacrosLogOnSuccess().

◆ _mMacrosLogOnSuccess [2/2]

TestSupport.TestHelper.TestHelper._mMacrosLogOnSuccess
protected

◆ _mModuleName

TestSupport.TestHelper.TestHelper._mModuleName = None
staticprotected

The name of the currently tested module.

Definition at line 281 of file TestHelper.py.

Referenced by TestSupport.TestHelper.TestHelper.getModuleName(), and TestSupport.TestHelper.TestHelper.setModuleName().

◆ _mPackageList

TestSupport.TestHelper.TestHelper._mPackageList = None
staticprotected

The list of packages that should be assumed to be available.

Definition at line 276 of file TestHelper.py.

Referenced by TestSupport.TestHelper.TestHelper.getPackageList(), and TestSupport.TestHelper.TestHelper.setPackageList().

◆ _mResultDirectory

TestSupport.TestHelper.TestHelper._mResultDirectory = None
staticprotected

The directory used to save results.

Definition at line 274 of file TestHelper.py.

Referenced by TestSupport.TestHelper.TestHelper.getInstance(), and TestSupport.TestHelper.TestHelper.getResultDirectory().

◆ _mStackFrame

TestSupport.TestHelper.TestHelper._mStackFrame = None
staticprotected

◆ _mTestCaseContext

TestSupport.TestHelper.TestHelper._mTestCaseContext = None
staticprotected

◆ _mTestCaseDataDirectory

TestSupport.TestHelper.TestHelper._mTestCaseDataDirectory = None
staticprotected

◆ _mTestCaseName

TestSupport.TestHelper.TestHelper._mTestCaseName = None
staticprotected

The name of the current test case.

Definition at line 279 of file TestHelper.py.

Referenced by TestSupport.TestHelper.TestHelper.getTestCaseName(), and TestSupport.TestHelper.TestHelper.setTestCaseName().

◆ _mTestCaseResultDirectory

TestSupport.TestHelper.TestHelper._mTestCaseResultDirectory = None
staticprotected

The documentation for this class was generated from the following file: