← Back to team overview

sikuli-driver team mailing list archive

[Question #163277]: Using images from dictionaries in unit tests

 

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

Hi, 

Today I thought I should learn how to make unit tests. At current state I have written two different tests. One which contains the images direcly in the testfile and one which refers to the images as keys in a dictionary which is in another file. 

Both tests are identical to the point where the images are stored. And none of them returns any Errors when doing a normal Run. 

The problem is that only the test where the images is directly stored in the test are working.
How would I do in order to make the other test run aswell? 
The script which got the images in a dictionary in another file is identical apart from where images are called. Like in the wait() below

In the dictionary test it looks like this: wait(imgSet.getImage("imageAsString")) Everything works when not in unit test mode so it could not be that the dict is imported wrong (imported as you swhown me yesterday. )

Here is the code: 

def setUp(self):
    App.open(r"c:\Program\Firefox.exe")
    wait("image.png") 

def tearDown(self):
    App.close(r"Firefox")
    wait("element on desktop")

def test_findGuiElementButton(self):
    if not exists("toolBar.png"):     #just checks if firefox is in focus
        print("Not focus")                    #if not print "Not focus"
    if exists("theButton.png"):       #check if a specific image, in this case button is visible
        return True
    elif not exists("theButton.png"):
        return False         
        print("Does not exists")        #if not visible print "does not exist"

Feels like I have been trying everything. The only positive thing this day is the sunny weather. :-)

Hope the sun shine above your heads aswell! 
  


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