← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #192601]: Unittest - unable to start the application from setup

 

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

Description changed to:
**** setup function in class TestCase is named

setUp() # uppercase u

-------------------------------------------------

In unittest unable to start the application from setup but same code
works in tes1. Not sure what i am doing wrong. Here is the code snippet

dir = "c:/SikuliScripts/HTMLTestRunner"
import os
fp = file(os.path.join(dir, "AViewTest.html"), "wb")

import unittest
import HTMLTestRunner
reload(HTMLTestRunner)

class MyTest1(unittest.TestCase):
    def setup(self):
        #aview = App(r'C:/Files/Classroom/Classroom.exe')   # not able to start the app
        #aview.open()
        wait(5)
    def test1(self): 
        aview = App(r'C:/Files/Classroom/Classroom.exe')   # same scripts I can run from here
        aview.open()
class MyTest2(unittest.TestCase):
    def test1(self):
        assert False

suite = unittest.TestLoader().loadTestsFromTestCase(MyTest1)
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(MyTest2))
runner = HTMLTestRunner.HTMLTestRunner(stream = fp, verbosity=2, dirTestScreenshots = dir)
runner.run(suite)
fp.close()

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.