← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #188751]: Sikuli Test hanging when running unit test - fine when through IDE

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
if you want to run this in IDE normally and in the unit test view, it
has to be this way:

def setUp(self):
  App.open("notepad.exe")
  wait("UntitledIFil.png") # wait until the app appears

def tearDown(self):
  App.close("notepad.exe")

def testA(self):
  assert exists("UntitledIFil.png")

def testB(self):
  assert not exists("UntitledIFil.png")

if False: # set it to True when running normally
    setUp(None)
    testA(None)
    testB(None)
    tearDown(None)

Do not forget to save your script after making changes and before
running in unit test view.

---   App.close("notepad.exe")
App.close() looks for the given text in the currently open windows titles. So to use it, you have to use something like 
  App.close("Untitled")
Make sure you are using a unique text among all present window titles.
Alternative: If you know, the notepad window is still frontmost: type(Key.F4, KeyModifier.ALT)

BTW: If you are planning to use Sikuli for unit testing: look faq 1804

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