← Back to team overview

sikuli-driver team mailing list archive

[Question #671096]: Is there any or any linked issue where I see how to have proper error handling in case we have multiple scripts and one of them failed then the program should continue with the rest of the execution flows, skipping that paty

 

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

from sikuli import *
import OpenApplications
reload(OpenApplications)

dir = os.path.dirname(getBundlePath()) # the folder, where your script is stored
def setUp(self):
    logging.basicConfig(filename='..\\logfile.log', level=logging.DEBUG)
    Images.images()
def tearDown(self):
    OpenApplications.CloseApp()
    self.app.close()

class TestDemo(unittest.TestCase):

	    def functiontest1(self):
		try:
			OpenApplications.OpenApp()
			print 'Applications should be opened successfully'
			click('Image1') ---> #This image is not present so program should not halt and continue to next step
			OpenApplications.CloseApp()
		except Exception as e:
			print (e)
		
		#Also program should execute this function even if it encounters some issues in above code
		def functiontest2(self):
        OpenApplications.OpenApp()
        print 'Applications should be opened successfully'
        OpenApplications.CloseApp()
		
suite = unittest.TestLoader().loadTestsFromTestCase(TestDemo)
outfile = open("..\\results.html", "w")
runner = HTMLTestRunner.HTMLTestRunner(stream=outfile, title='Test Report', description='Test Flows' )
runner.run(suite)
outfile.close()

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