← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #143981]: unit test

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
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.

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