← Back to team overview

sikuli-driver team mailing list archive

[Bug 867636] Re: X-1.0rc3: Windows: Unittest from command line with -t: image files not found

 

@ David

since this is a problem, when running test scripts from command line,
the test feature of the IDE is not really needed.

So I recommend to use Python's unittest feature directly, by just adding
a few lines of code (see faq 1804).

** Summary changed:

- X-1.0rc3: Windows: Unittest from command line with -t: image files not found
+ X-1.0rc3: Windows: Unittest from command line with -t: image files not found --- workaround

** Description changed:

+ ***** workaround
+ 
+ use Python's unitttest feature directly and run the scripts normally in
+ IDE and with option -r from command line.
+ 
+ see faq 1804
+ 
+ ---------------------------------------------------------------------
+ 
  I am running Sikuli X 1.0rc3 on Win7 Professional x64. My goal is to use
  the unit test features of Sikuli to write some automated tests. I have
  built several demo unit test scripts (testing notepad and an in house
  app) which run fine in the Sikuli IDE, but do not run correctly from the
  command line.
  
  For example, here is a notepad test file I have written (this is the
  python code, obviously it has the pretty pictures in the IDE):
  
  --------------------------------------------
  notepad = App("notepad.exe")
  
  def setUp(self):
-  self.notepad.open()
-  wait("UntitledNote.png", 20000)
+  self.notepad.open()
+  wait("UntitledNote.png", 20000)
  
  def tearDown(self):
-  self.notepad.close()
-  waitVanish("UntitledNote-1.png", 20000)
+  self.notepad.close()
+  waitVanish("UntitledNote-1.png", 20000)
  
  def test_textarea_add_del_by_key(self):
-  type("hello world")
-  assert exists("helloworld.png")
-  type("a",KEY_CTRL)
-  type("\n")
-  assert not exists("helloworld.png")
+  type("hello world")
+  assert exists("helloworld.png")
+  type("a",KEY_CTRL)
+  type("\n")
+  assert not exists("helloworld.png")
  
  def test_textarea_add_del_by_key_clipboard(self):
-  type("hello world")
-  # fill clipboard for assert
-  type("a",KEY_CTRL)
-  type("c",KEY_CTRL)
-  assert Env.getClipboard() == "hello world"
-  type("\n")
-  # fill clipboard for assert
-  type("a",KEY_CTRL)
-  type("c",KEY_CTRL)
-  assert not Env.getClipboard() == "hello world"
+  type("hello world")
+  # fill clipboard for assert
+  type("a",KEY_CTRL)
+  type("c",KEY_CTRL)
+  assert Env.getClipboard() == "hello world"
+  type("\n")
+  # fill clipboard for assert
+  type("a",KEY_CTRL)
+  type("c",KEY_CTRL)
+  assert not Env.getClipboard() == "hello world"
  --------------------------------------------------
  
  When I run this from the IDE (toggle Unit Tests from the View menu, then
  click the Unit Tests run button), everything runs fine and I get 2/2
  tests run to completion. However, when I run it from the command line,
  the tests fail with "[error] UntitledNote.png looks like a file, but
  can't be found on the disk. Assume it's text." Full output below:
  
  C:\Users\username\Desktop>"%SIKULI_HOME%\sikuli-ide.bat" -t c:\users\username\Desktop\notepad_tests.sikuli
  [info] Sikuli vision engine loaded.
  [info] Windows utilities loaded.
  [info] VDictProxy loaded.
  .[log] App.open notepad.exe(7868)
  [error] UntitledNote.png looks like a file, but can't be found on the disk. Assume it's text.
  [info] Text Recognizer inited.
  [error] UntitledNote.png looks like a file, but can't be found on the disk. Assume it's text.
  [error] UntitledNote.png looks like a file, but can't be found on the disk. Assume it's text.
  ...
  
  So, it looks to me like this is some sort of pathing issue. I have tried
  adding the path to the .sikuli directory to the image path as the first
  line of the script based on another Q&A, but that did not work. Are
  there other steps I should try to troubleshoot this?

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/867636

Title:
  X-1.0rc3: Windows: Unittest from command line with -t: image files not
  found --- workaround

Status in Sikuli:
  Confirmed

Bug description:
  ***** workaround

  use Python's unitttest feature directly and run the scripts normally
  in IDE and with option -r from command line.

  see faq 1804

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

  I am running Sikuli X 1.0rc3 on Win7 Professional x64. My goal is to
  use the unit test features of Sikuli to write some automated tests. I
  have built several demo unit test scripts (testing notepad and an in
  house app) which run fine in the Sikuli IDE, but do not run correctly
  from the command line.

  For example, here is a notepad test file I have written (this is the
  python code, obviously it has the pretty pictures in the IDE):

  --------------------------------------------
  notepad = App("notepad.exe")

  def setUp(self):
   self.notepad.open()
   wait("UntitledNote.png", 20000)

  def tearDown(self):
   self.notepad.close()
   waitVanish("UntitledNote-1.png", 20000)

  def test_textarea_add_del_by_key(self):
   type("hello world")
   assert exists("helloworld.png")
   type("a",KEY_CTRL)
   type("\n")
   assert not exists("helloworld.png")

  def test_textarea_add_del_by_key_clipboard(self):
   type("hello world")
   # fill clipboard for assert
   type("a",KEY_CTRL)
   type("c",KEY_CTRL)
   assert Env.getClipboard() == "hello world"
   type("\n")
   # fill clipboard for assert
   type("a",KEY_CTRL)
   type("c",KEY_CTRL)
   assert not Env.getClipboard() == "hello world"
  --------------------------------------------------

  When I run this from the IDE (toggle Unit Tests from the View menu,
  then click the Unit Tests run button), everything runs fine and I get
  2/2 tests run to completion. However, when I run it from the command
  line, the tests fail with "[error] UntitledNote.png looks like a file,
  but can't be found on the disk. Assume it's text." Full output below:

  C:\Users\username\Desktop>"%SIKULI_HOME%\sikuli-ide.bat" -t c:\users\username\Desktop\notepad_tests.sikuli
  [info] Sikuli vision engine loaded.
  [info] Windows utilities loaded.
  [info] VDictProxy loaded.
  .[log] App.open notepad.exe(7868)
  [error] UntitledNote.png looks like a file, but can't be found on the disk. Assume it's text.
  [info] Text Recognizer inited.
  [error] UntitledNote.png looks like a file, but can't be found on the disk. Assume it's text.
  [error] UntitledNote.png looks like a file, but can't be found on the disk. Assume it's text.
  ...

  So, it looks to me like this is some sort of pathing issue. I have
  tried adding the path to the .sikuli directory to the image path as
  the first line of the script based on another Q&A, but that did not
  work. Are there other steps I should try to troubleshoot this?

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/867636/+subscriptions


References