RaiMan / SikuliX-2014

SikuliX version 1.1.2 (until February 2018)
http://sikulix.com
806 stars 235 forks source link

Recommend method for using SikuliX with Robot Framework #257

Closed GeorgSteyn closed 7 years ago

GeorgSteyn commented 7 years ago

Hi, I am currently using SikuliX version 1.1.1. Also, I am new to the Robot Framework and I am using this reference for Robot Framework Sikuli Test Scripts.

At the end of that page the doc talks about a method to execute robot framework in Sikuli:

prepareRobot() # takes care for the correct environment

workdir = getParentFolder()
script = "arobottest/arobottest.robot"
robotscript = os.path.join(workdir, script)

print "*** trying to run:", robotscript
robot.run(robotscript, outputdir=workdir)

I am using this method and it works perfectly if you only run a single .sikuli test.

In my case, I am running multiple Sikuli tests from one main Sikuli test script by importing them. As soon as you import a sub Sikuli test in the main Sikuli execution script. The robot.run() don't work anymore because the robot module isn't recognized by Sikuli.

The reasons I originally changed my test system to work from one Main Sikuli Test execution file is because of the long loading time of the Sikuli API (I know this is done in the API because there are many things to import from the API.) You can Imagine what effect this is when you are running 100+ .sikuli test scripts one after they other. You lose a lot of time.

What would you recommend to do in this matter? NOTE: Every test is executed from the cmd in this manner: "call C:\SikuliX\runsikulix.cmd -r"

RaiMan commented 7 years ago

I am not sure, wether I understand the question: I cannot see any import in this scenario.

On the other hand: import is not the recommended way, to run other scripts (import is a means to make classes, methods and names available in more than one environment: write once - use multiple times). The feature to be used in your case is: http://sikulix-2014.readthedocs.io/en/latest/scripting.html#running-scripts-and-snippets-from-within-other-scripts-and-run-scripts-one-after-the-other

Back to your RFW question: Might be a misunderstanding, but it is a basic decision, wether to use SikuliX Python scripting for your tests OR use RobotFramework for your tests. In the latter case the top level element is a .robot and the keywords might be implemented using Python scripting, where you now might use import for already implemented keywords.

So please rethink your situation and come back with an example, of what you are missing.

GeorgSteyn commented 7 years ago

Thanks for the Quick Answer RaiMan. Currently I have a big test system for QA Testing with Sikuli. I recently found the Robot Framework.

So from what I have seen and your replay. I assume my approach that I used for last few months is going to be reviewed.

Instead building everything around the Sikuli API...would now be changed to build everything around the Robot Framework and use Sikuli to fill in the GUI parts and typing.

For our QA testing this approach wil be best.

Thank You, Very Much for the Quick Replay again.