← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #671096]: unit testing: how to handle exceptions and continue in case of failures

 

Question #671096 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/671096

    Status: Answered => Open

Sonali is still having a problem:
Thanks Raiman. This is true when I know forhand which images will not be present and I can use if exists.
What for the images which may be not present at runtime , due to a bug in the code or any other reason.

As in, let's say if any of the images/steps in 
functiontest1(self): OpenApplications.OpenApp() is incorrect then still it should catch that particular exception and continue rest of the program execution
OpenApplications.CloseApp() and also to next function in testdemo class
functiontest2(self)

OpenApplications.OpenApp()  has series of actions. Some of them are as
follows:

def OpenApp():
    click('Start')
    wait(1)
    click('Exceutive')
    wait(10)
    click('Control')
	etc...


class TestDemo(unittest.TestCase):

	    def functiontest1(self):
		try:
			OpenApplications.OpenApp()
			print 'Applications should be opened successfully'
			OpenApplications.CloseApp()
		except Exception as e:
			print (e)

         def functiontest2(self):
                   OpenApplications.OpenApp()
                   print 'Applications should be opened successfully'
                  OpenApplications.CloseApp()

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.