← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #172559]: logging result of assert

 

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

RaiMan posted a new comment:
If you set up a unit test for the IDE feature, it does not do anything
on a normal run, because it only consists of def() functions.

this is the base for such a unit test:

def setUp(self):
    print "setup"

def test1(self):
    print "test1"
    assert(True)

def test2(self):
    print "test2"
    assert(False)

def tearDown(self):
    print "teardown"

One of the major problems with this feature is the handling of syntax
errors: If you have an error, the test will just hang and you have to
abort it to get back to the IDE and check what happened. If you run
tests from command line with -t, you will see the error message in the
command window.

The feature used by Sikuli IDE in the background is the unit test module
of Jython. The above test functions are wrapped into a test case class
and the test run feature is added internally.

If you are really interested in unit testing, just use the Jython feature yourself (not so complicated ;-). So you have all options and transparency. And you can run it as normal workflow in the IDE or with -r from command line.
see: https://answers.launchpad.net/sikuli/+question/171632 comment #2
here you can find the for Sikuli recommended base structure

more information:
Python: http://docs.python.org/release/2.5.2/lib/module-unittest.html

You might google for other docs.

If unit testing is not your primary intention: see my recommendation in
comment #1

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