← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #208458]: Unit test exception/script problems

 

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

Joost posted a new comment:
@ j (j-the-k)
Regarding the import i'm using: it abstracts away browser specific actions (like checking and accepting for invalid SSL certificates)

And I'm using it as follows:

def setUp(self):
    import os
    myPath = os.path.dirname("/location/of/browser/module/")
    if not myPath in sys.path: sys.path.append(myPath)
    import Browser
    # reload, in case it has been modified
    reload(Browser)

def tearDown(self):
    pass

def test_myWebsite_with_FireFox(self):
    import Browser        
    self.browser = Browser.FireFox()
    # now do stuff with my browser

def test_myWebsite_with_InternetExplorer(self):
    import Browser        
    self.browser = Browser.InternetExplorer()
    # now do stuff with my browser

As the files referenced from the imported module are not located in the
same folder as the unit test, it fails on finding the images; copying
them solves that problem, but it is less than elegant.

Also, it is not clear AT ALL, that the class name (that is, file name)
may not contain spaces in order to be used for unit testing, I have not
found any documentation anywhere. It is not clear to me why the filename
is used as a class name, it might as well be some kind of anonimized
name (e.g SikuliUnitTest123) as it should be invisible to the user as
well. This really seems like a bug to me, at least do a sanity check on
the filename before showing the user a Java compilation error that is
non-descriptive.

My problem with your comment is this: using the filename as Java class
name is _implicit_, the naming of functions in the IDE follows the
Python convention and therefore it is _explicit_ that no spaces or other
exotic characters may be used in the method/function name. This is a big
difference IMHO.

@RaiMan thank you, I will definitely try that, as the Unit Testing part
of the IDE does not seem very mature to me.

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