X-1.0rc3: Windows: Unittest from command line with -t: image files not found --- workaround
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
Won't Fix
|
Undecided
|
RaiMan |
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.
wait("
def tearDown(self):
self.notepad.
waitVanish(
def test_textarea_
type("hello world")
assert exists(
type("a",KEY_CTRL)
type("\n")
assert not exists(
def test_textarea_
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\
[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?
some more information in the linked question