← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #168233]: Test Case Results Error

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
- no, setUp() and tearDown() are not needed, only if you have some
things to do before (setUp) and after (tearDown) each test. Internally
the Python unit test module is used (the necessary environment/wrapper)
is created internally. So the Python docs apply.

- should give an error
def tearDown(self):
 close(self)

since close is not useable without a referenced object (in this case in
Sikuli it is actually mapped to the constant object SCREEN, which is the
main screen Screen(0))

- This is a general problem with the current version of this "gimmick"
in the IDE: if you get any errors during a test run, that are not
catches (e.g. the above syntax error), you will not see it at all and
the IDE might hang, so you have to restart.

- generally: If you make any changes to your code, you have to save
before running again (the test run is based on the saved version of your
script)

I have made a script frame, that can be run either in the normal IDE
environment or in the unit test window and allows you, to first gat your
script error free, before looking at assertions.
(https://files.me.com/rhocke/zpsan6)

--- One more thing:
when playing around, a test case, that does not do real assertions, you should end it with an assert(True), since every test case should end with an assert().

so a minimal test script should look:

def setUp(self):
 pass

def test_calculator(self):
 print "in test_calculator"
 assert(True)

def tearDown(self):
 pass

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