test execute OK in IDE but gives error in commandline

Asked by piravel

I'm trying to launch a simple sikuli unit test in command line.

I wrote a simple unit test in sikuli IDE. It executes fine in the "unit test" view of the IDE. But when I try to execute the same scipt in commandline it gives me errors.

I launch the script with the following command :
Sikuli-IDE.bat -t TESTS\testIE.sikuli

And the error I get is:

Time: 5,031
There was 1 error:
1) test_affichage_favoris(org.python.proxies.__main__$testIE$4)FindFailed: can not find 1302247948937.png
  Line 29, in file <string>
        at org.sikuli.script.Region.handleFindFailed(Region.java:349)
        ...

The application is open and the image is visible, I don't understand why the image is not found when I launch the script in commandeline?
Any Ideas ?

My script is the following

def setUp(self):
  openApp("C:/Program Files/Internet Explorer/iexplore.exe")
  wait(2)

def tearDown(self):
  closeApp("Internet Explorer")

def test_affichage_favoris(self):
  click("1302247948937.png")
  assert (exists("FluxHisturiq.png"))

Thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Might it be, that the image is hidden behind the command line window in this moment?

This means, in that moment YOU see the image?

Revision history for this message
piravel (pkeravel) said :
#2

Thanks for the quick support!

Yes I can see the image.
When internet explorer opens, it comes up to the front and so the command line window is not visible until the error comes up

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Ok, then try the following (might be a timing problem):

def test_affichage_favoris(self):
  click(exists("1302247948937.png", 10))
  assert (exists("FluxHisturiq.png"))

If the image is not found after 10 seconds, the click does nothing and your assert fails.

Revision history for this message
piravel (pkeravel) said :
#4

With this solution the image "1302247948937.png" is not found after 10 seconds and I get an assertion error.

But I don't understand why the image 1302247948937.png is not found even if it is visible on my screen?

Revision history for this message
RaiMan (raimund-hocke) said :
#5

yes really, a good question.

I will make a test on my Win7.

Revision history for this message
piravel (pkeravel) said :
#6

OK thanks.
For info, I'm on winXP using Sikuli X 1.0

Revision history for this message
RaiMan (raimund-hocke) said :
#7

I am sorry, but I have to confirm, that on my Win7 I am facing the same problems (never thought, that this is possible, because I thing that some people are running the test feature from command line). Any find operations fail, though they should not.

I will post a bug later, if you do not want to do it.

If you want to set up serious (sorry, but the developers themselves have confirmed, that the test feature in total has to be renewed) test cases, that definitely can be run on the command line, just use the Python unittest feature yourself. It is rather easy to use and works in the normal IDE run.

(in fact, the IDE test feature is nothing else, than a wrapper around the unittest feature ;-)

If you really want to use unittest and have questions, come back.

Revision history for this message
piravel (pkeravel) said :
#8

OK. I let you post the bug and I'll look into this Python unittest.
 thanks for your quick answer.

Can you help with this problem?

Provide an answer of your own, or ask piravel for more information if necessary.

To post a message you must log in.