← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #205157]: unit test

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Uuuuups, this is a very basic question.

Using Sikuli, you use the visual approach:
A GUI should produce an area on the screen containing specific images. So a typical test scenario is, to drive the app to the point of interest (which could be done with Sikuli's app, mouse and keyboard features), and then you check, wether a prepared image (how it should be) is at the place where it should be and is the same pixel per pixel.

example:

def testButton(self):
imgButton = "some-wanted-button-image.png"

# drive app to point of interest (could be done in setUp() )

assert exists(imgButton)

This has to be embedded in a standard UnitTestFramework like the basic
ones in Python or Java or more feature rich ones like RobotFrameWork and
others (see faq 1804)

--- I need to know where and how I see these errors.
Using the basic unit testing features, you have to implement your own reporting on that, which might be combined with capturing screens ore regions containing errors (e.g. HTMLTestRunner with the capture feature).

In cases where I sit before the screen and want to know, what happens
and what not, I usually use either the slow motion run mode or the
Region.highlight() method, which gives some information, about where,
the script is acting currently and might give hints in the case it
crashes or goes wrong. But this is not appropriate for unit testing,
which normally runs long and unattended.

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