How to setup a testing framework, that uses Sikuli automation features

Asked by AmTv

My program can do unit testing but when I press the start button to run the program or run the exe I created, it does not work , can anyone please help me with this?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

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

Are you really talking about Sikuli?

If yes:
what system?
what Sikuli version?

be more specific: symptoms, error messages?

Revision history for this message
AmTv (tiaanvalentine) said :
#2

Hi
Yes sikuli version r930 tried the mewer one but it doesnt work properly on a virtual machine. Im using qindows XP, it is a program that only works on it.

Basically I can do unit testing but if I press alt+shift+c to run it nothing happens. No errors occur, the windows console opens and closes icons, is there an auto skip command i.e. that if the program does not see the first command, it skips to the next command

Thanks

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

-- alt+shift+c
... is the hot key to abort a script that loops and does not end by itself.

the hotkey to run a script is ctrl-r

-- is there an auto skip command
no, there is nothing like that

-- Basically I can do unit testing
... if you are talking about the unit test feature in the RC3 IDE: this is no longer supported in this way (faq 1804)

BTW: tried the mewer one but it doesnt work properly on a virtual machine
... what are the problems? was it the latest version of 1.0.1?

Revision history for this message
AmTv (tiaanvalentine) said :
#4

I think me and you don't understand each other properly :D so im gonna try and rephrase the question. I am working to create a huge sikuli automation test and this has error logs in and now im trying the unit testing because the program became to huge to press ctrl-r the whole time so i created my setUp() and tearDown() commands and gave every module or test area a name for the unit testing but when i run the unit testing it works perfectly but when u press ctrl-r it opens the windows command closes it and does not start the program. Secondly i want to know if there is a way to create multiple sikuli apps and link them in a way so that u can create them separately but that one can call the other. Also referring back to the skip command say for instance i have a big program it goes through actions and then it comes to a point but cannot locate an icon or text is there a way that u can make it skip that and go on to see if can find the next icon or text? New version of Sikuli gives me a download error i do precisely as stated on the read me file but there is a download error.

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

-- I think me and you don't understand each other properly :D
This is a very polite description for the fact, that you think, that I am not answering your questions in away, that are suitable for you ;-)

But please take into account: The more precise and complete you are talking about your situation and expectations, the better the answers will be. Trust me and my experience of having handled now hundreds of questions and comments on Sikuli during the last 3 years.

So again:
- Are you using the UnitTest feature available in the RC3 IDE (View -> Unit Test)?
if yes: faq 1804

... and when working on "I am working to create a huge sikuli automation test", I really recommend to run the scripts from command line or use some mature IDE (Eclipse, Netbeans, ..) with debugging support.

BTW: (as it is understood normally)
automation: means, you are driving an application using the visual search, mouse and keyboard features of Sikuli
test: means, you have setup a test suite with test cases, that is used to assert the results produced by an application under development, after the app is driven to a specific point.

So, a more specific description of what you are really doing would help a lot.

-- you ask: Secondly i want to know if there is a way to create multiple sikuli apps and link them in a way so that u can create them separately but that one can call the other.

Sikuli talks Python and the whole world of structuring the work into scripts/modules is available (see docs: http://doc.sikuli.org/globals.html#importing-other-sikuli-scripts-reuse-code-and-images)

-- you ask: Also referring back to the skip command say for instance i have a big program it goes through actions and then it comes to a point but cannot locate an icon or text is there a way that u can make it skip that and go on to see if can find the next icon or text?

again: Python is your friend with all the constructs a scripting language has

-- you say: New version of Sikuli gives me a download error i do precisely as stated on the read me file but there is a download error.
see faq 2363

Revision history for this message
AmTv (tiaanvalentine) said :
#6

if i offended u in a way sorry lol but i have many questions that is not very clear and i been reading and studying sikuli from last year July and now at (student atm) i must create a test program to test one of their programs and they want error logs and so on so that is why i do not give wide descriptions because of it might be private so ye its not the new version its r930 version so ye im going far out of my way to get this program working to their specific i take it further than just simple buttons and mouse actions u might get more questions from me im gonna go do some more homework on this -_- but thanks that u respond fast on this appreciate it.

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

I am really willing to help you. No problem - you did not do anything wrong.

What I can offer you is, that we can communicate privately over my mail at https://launchpad.net/~raimund-hocke.

This way I think you could give some more specific information about your case (maybe after having talked about this with your authority).
I have already done this n the past even together with non-disclosure agreement.

So as I understand now, it is really some application testing:
all my recommendations in comment #5 apply 100% ;-)

especially using Netbeans or Eclipse with the Python plugin.

Revision history for this message
AmTv (tiaanvalentine) said :
#8

k since i cant im gonna ask u help its an example i taught of say i have been asked o test Microsoft office word or excel lets stick with word. My objective is to test every single button input and actions that comes with Microsoft office word. I have the following to accomplish i must create automation software and with this i must have an error log that displays the errors in a file, and if it cannot find something it reports the error but goes on with running the program like it does what it can until the end. If u understand what im saying if im not making sense say so :D its early when i get to work really early so my mind is not completely set to rephrasing words or sentences

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

ok, that is standard unit testing.

So you have to get familiar with that (again faq 1804).
Is rather easy and flexible with Python.

On top we have the HTMLTestrunner, that produces nice test reports in HTML in a modified version even with screenshots in case of failed tests.

Everything else, I already mentioned is still true.

I would recommend, to first start with the Sikuli IDE with some basic snippets, that e.g.
-- start your app and bring it in a state to start a test (setup)
-- find buttons, click them and get a feeling how to check the outcome (test case)
-- shut down your application or reset it into a state like just being started (teardown)

Then you should make a top-down design of your test cases and suites and implement the required classes and decide about packaging into modules.
Now build your final setup and teardown methods and make them work with one empty test case.
This should be setup in Eclipse with Python plugin.
Now you know, that your testing framework works together with the automation framework.

About the images:
In your Eclipse project have an images.sikuli, that you use with the Sikuli IDE, to capture the images. Name the images using a naming scheme, that fits your testing structure and naming.
In Eclipse, the script needs at the beginning:
from sikuli import *
import os
sys.path.add(os.path.join(java.lang.System.getProperty("user.dir"))
import images

the latter tells Sikuli, where to find the used images.

with this setup, you even might test snippets in images.sikuli in Sikuli IDE and just copy and paste them to your Eclipse script.
Take care, that images.sikuli does not contain any executable code, when running your stuff in Eclipse.

Revision history for this message
AmTv (tiaanvalentine) said :
#10

Thx mate this makes it much more clear to me will dig deeper into this :D sorry if these questions and my sentence building was confusing.

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

all the best.

always welcome.

If you take the time and effort to communicate I will do too ;-)

Revision history for this message
AmTv (tiaanvalentine) said :
#12

I have a new question i have read downloaded all needed stuff for sikuli to work on eclipse this might sound stupid but its frustrating me now i followed the steps as stated on the website to link sikuli into eclips http://doc.sikuli.org/faq/040-other-ide.html part where i Configure for using Sikuli script features at run time. first part clear as daylight second part where i need to reference a path to sikuli it stays i must select sikuli-script.jar is that actually the ide that it is referring to since i have now the latest version of sikuli the v1.0.1 it ends up just having a lib folder and sikuli-ide in it. after that the lib adding is easy that i done. also another question i see on many of these examples even one similar to mine they are talking about a main.py which python but some people also create e.g main.sikuli is there a special way or is it only possible if the links and libraries are correctly integrated with eclipse.

your answer will be greatly appreciated.

Revision history for this message
AmTv (tiaanvalentine) said :
#13

just read more abit the script and ide same thing

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

Ok, might be a bit complicated (will be streamlined with 1.1.0+ ;-):

- http://doc.sikuli.org/faq/040-other-ide.html
is for RC3 and not for version 1.0.1 (I am a little behind with the docs ;-)

look here:
https://github.com/RaiMan/SikuliX-API/wiki/Usage-in-Java-programming

sikuli-ide.jar is for to start the Sikuli IDE and (not relevant for you) to run scripts from command line.

For your usage, you have to select options 1 and 3, which gives you sikuli-ide.jar and sikuli-java.jar.
The latter has to be used with your work in Eclipse.

Just delete everything from the setup folder except sikuli-setup.jar and run setup again (options 1 and 3)

Revision history for this message
AmTv (tiaanvalentine) said :
#15

THX will go play around a bit with it.

Revision history for this message
AmTv (tiaanvalentine) said :
#16

new error encountered i have done all the steps of sikuli i got everything right it detects sikuli script but a have an irritating error

File "C:\Documents and Settings\User\workspace\Automation\Test.py", line 1, in <module>
  from sikuli.Sikuli import App
  File "__pyclasspath__/sikuli.py", line 7, in <module>
TypeError: log(): 1st arg can't be coerced to String

i used something small to test it

class my_keyword(object):
    ROBOT_LIBRARY_SCOPE = 'GLOBAL'

    def __init__(self):
        pass

    def open_app(self):
        App.open("calc.exe")

if __name__ == "__main__":
    my = my_keyword()
    my.open_app()

im not completely sure since this is my first time working with eclipse and i only studied in c# so its interesting but frustrating challenge i have to face

Revision history for this message
AmTv (tiaanvalentine) said :
#17

gonna keep u busy the next 2 months lol alot of questions

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

that principally is no problem.

.. but more personal questions or questions due to your lack of experience I want to discuss privately via the mail you already know

In this case:
please send me your zipped Eclipse project folder, a screenshot of the Sikuli setup folder and the setup log file.

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

This question should not be continued.