I am new on sikuli and started using sikuli as project requirement.PLease tell me any advance sikuli tutorial website

Asked by ravi

please tell me advance tutorial website.

i have done basics of it.

IF possible please share any pdf which can help out.

THANKS

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Zeks (enmarantispam) said :
#1

I am interested - what do you mean by "project requirement"? Is there some policy in the company that makes sikuli scripts for any functionality a must ? If so, why don't they give guidelines for it?

Revision history for this message
ravi (ravisidhu86) said :
#2

Its client requirement to make test script on sikuli IDE.

PLease guide me through tough and advcance sikuli IDE functionality.

THANKS

Revision history for this message
Zeks (enmarantispam) said :
#3

well, I don't really know any advanced tutorial, but here is what I've learned so far:

1) turn off automatic image naming. you'd want to work outside sikuli IDE for any serious testing and file' names should make sense cause you will not see images anywhere else
2) reuse screenshots when possible. try to place them outside top level sikuli test scripts if there is a chance that they will be needed elsewhere
3) Modularize test scripts. Some operations are inevitably going to be shared between scripts and copy pasting them is a big no. Modularization helps code reuse as you only have ONE place to fix the code in.
4) Limit the scope the application has to search to find a match. For most windows I split them into named subregions and only perform matches within them, not a global window. If a split is made at runtime it can even compensate for small interface changes. Split is done by anchor points which really are elements that define corners of a particular region.
5) Do not debug scripts in sikuli IDE. it wastes a lot of time as it is clearly not suited for the task
6) You will most likely need to automate scripts. Learn how to use robot framework early. It really is not that hard and helps a lot
7) keep scripts in source control repository. in the end test scripts are code, same as project code and deserve same treatment
8) Sikuli currently has no error reporting on operations such as click(). Prepare to check the sanity of operations such as click(None) yourself

Keep in mind that I am a total Sikuli noob myself and I am still learning too. Maybe someone can give better guidelines.

Revision history for this message
ravi (ravisidhu86) said :
#4

Thanks A LOT

Please also guide me which languages i should learn to get best use of Sikuli

python or anything more.....

THANKS

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

@Zeks
Very good points. Thanks. Will use them for some doc section "Best Practices".
question at 6: what does "automate scripts" mean together with Robot Framework?

Revision history for this message
Zeks (enmarantispam) said :
#6

If there are a bunch of test scripts for some application, chances are - you'd want to run them in succession, preferably not startng each one by hand and , ideally, getting a combined report. Robot framework does just that.

Revision history for this message
RaiMan (raimund-hocke) said :
#7
Revision history for this message
Zeks (enmarantispam) said :
#8

9) Abstract away interface elements such as buttons and table cells
When you write
 click(Pattern('send.png'))
what you really want is to click on button, not on screenshot. And buttons have states.
A button can be pressed, hovered or cleaned, same with table cells. Instead what will save you time is:
 clickEntity('button')
the clickEntity function you will have to write yourself. It needs to match not one, but 3 screenshots and give/click the best match.
How it will do that is debatable. I, at the moment, do stuff like this
 buttons = ['send', {name = 'send', states = ['clean', 'hovered', 'pressed']}]
In the folder there are files send_clean.png, send_hovered.png...
So if I have a send window it is implemented in Send module and used as
 Send.clickEntity('send')
The function iterates over buttons dictionary, creating names as it goes and tries to find each one.

The result? Where you'd likely have to write in the main script(each time):

 click(Pattern('send_clean.png'))
 if not
  click(Pattern('send_hovered.png'))
 if not
  click(Pattern('send_.png'))

it becomes simple
 Module.click('entity')

this helps both readability and abstraction and will likely save you a lot of time

Revision history for this message
Zeks (enmarantispam) said :
#9

cleaned = clean in the previous post. meaning button without any state changing its appearance

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

@Zeks
-- Abstract away interface elements such as buttons and table cells
again good point.
to better support such solutions is on the list for version 2

... but already 1.1.0 will have some abstracting features like findAny(imageList) and findBest().

the button problem could the be solved like that:

btnOn = "btnOn.png"
btnOff = "btnOff.png"

imgList = (btnOn, btnOff)

m = someRegion.findBest(imgList)
m.highlight(1)
if m.getIndex() == 0:
    print "*** should be ON"
else:
    print "*** should be OFF"

findBest() is already available in the latest build

internally the findops are threaded and hence run in parallel (timing advantage with 3 and more images)

Can you help with this problem?

Provide an answer of your own, or ask ravi for more information if necessary.

To post a message you must log in.