How to run unit test in IDE

Asked by Jonathan Antognini

i try to excecute some unit test, like this

https://answers.launchpad.net/sikuli/+question/142947

but i can't, in the windows Test unit, not appear nothing.

I'm using sikuli X, in ubuntu 10.10.

Regards, and thanks =)

Question information

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

need more information about your problem.

send me your zipped .sikuli to my mail: https://launchpad.net/~raimund-hocke

Revision history for this message
Jonathan Antognini (jantogni) said :
#2

i only try execute one

assertExists(PATH_IMAGE)

and not work me, really i don't know how use this windows (unit test)

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

Only to be clear:

You always need a basic structure like that:

--1. Enter this in IDE:

def setUp(self):
 # here goes your code to prepare
 print "in Setup"

def tearDown(self):
 # here goes your code to sum something up
 # after all tests have been run
 print "in tearDown"

def test_empty(self):
 # each test case needs it's own def()
 # named test....
 print "in test"
 return True

instead of the True in return True you might use any expression that evaluates to True (test passed) or False (not passed):
e.g. your
assertExists(PATH_IMAGE)

Tip: it is recommended to only use the standard assert statements, so yours should read:
assert(exists(PATH_IMAGE))

--2. save the script e.g. test.sikuli (the script has to be saved after each change of your script before the next testrun)
then go to the testrun window and press run.

Revision history for this message
Jonathan Antognini (jantogni) said :
#4

thank you very much, the problem is:

the "run" button not appear always :S
sometimes not appear.

Thank you =)

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

if the run button is not visible, a test is still running in background.

Currently, you have to kill and restart Sikuli-IDE (bug reported) in cases where it does not end by itself.