def REQ002(self): # Test missing required argumentes self.trace('REQ002') testException(self, msg='No required arguments present', requirement="REQ002") testException(self, '-x %s -i %s' %(external, implantable), requirement="REQ002", msg='environment missing') testException(self, '-e %s -i %s' %(environment, implantable), requirement="REQ002", msg='external missing') testException(self, '-e %s -x %s' %(environment, external), requirement="REQ002", msg='implantable missing') testException(self, "-e %s -x %s -i %s -p pgsim='true'" %(environment, external, implantable), requirement="REQ002", msg='incorrect optional value') testException(self, "-e %s -x %s -i %s -p pgsim=otherVal" %(environment, external, implantable), requirement="REQ002", msg='incorrect optional value') testException(self, "-e %s -x %s -i %s -p pgsim=True,brwsr=False" %(environment, external, implantable), requirement="REQ002", msg='incorrect optional value') # Test optional parameter defaults argDict = {'env':self.env, 'external':external, 'implantable':implantable} testDefaultSuccess(self, argDict, requirement="REQ002", msg='default parameters') # Test correct command lines argDict = {'env':self.env, 'external':external, 'implantable':implantable} testSuccess(self, argDict, requirement="REQ002") argDict = {'env':self.env, 'external':external, 'implantable':implantable, 'pgsim':True} testSuccess(self, argDict, requirement="REQ002") argDict = {'env':self.env, 'external':external, 'implantable':implantable, 'pgsim':False} testSuccess(self, argDict, requirement="REQ002") argDict = {'env':self.env, 'external':external, 'implantable':implantable, 'debug': '-d'} testSuccess(self, argDict, requirement="REQ002") # Test Setup method commandString = '-e %s -x %s -i %s' % (self.env.name, external, implantable) setCommandLine(commandString) # Create a class to attach the objects that will be setup by KomodoRS class DummyObject(object): pass try: dObj = DummyObject() komodors.komodoRSSetUp(dObj) self.verifyTrue(hasattr(dObj, 'context'), msg='context added to object') self.verifyEqual(type(dObj.context), dict, msg='context type') self.verifyTrue(hasattr(dObj, 'brwsr'), msg='browser added to object') self.verifyEqual(type(dObj.brwsr), komodors.pocweb.Browser, msg='browser type') self.verifyTrue(hasattr(dObj, 'dataFactory'), msg='enrollment added to object') self.verifyEqual(type(dObj.dataFactory), komodors.enrollment.RockSpringsEnroller, msg='enrollment type') except: self.log.exception() self.verifyFailed(msg='komodoRSSetUp failure') raise # Test cannot go on from here # Test TearDown # As this method only breaks things down, it is only necessary to test that the # method handles all internal exceptions correctly. try: komodors.komodoRSTearDown(dObj) self.verified(msg='komodoRSTearDown success') except: self.log.exception() self.verifyFailed(msg='komodoRSTearDown failure') raise
def tearDown(self): # Tear down the KomodoRS environment after running the test case. This # method does the following: # 1. Closes all browser windows opened by POCWeb # 2. Closes any PG hardware handles attached to self.context['pg'] # 3. Stop any serial port logging of communicator handles attached to # the context in self.context['comm']. # # Note that the initializeHardware() method of the KomodoRS shortcuts # module attaches PG and comm hardware handles to self.context['pg'] and # self.context['comm'] dictionary keys when instantiated. komodors.komodoRSTearDown(self)
def tearDown(self): komodors.komodoRSTearDown(self)