RobotFramework: how to get it working (1.1.1 2016-05-25+)

Asked by Shobin

******************* valid for 1.1.1 2016-05-25+

I strongly recommend to first read through the docs:
http://sikulix-2014.readthedocs.io/en/latest/scenarios.html#using-robotframework

Any RobotFramework setup now is supported directly with SikuliX:

The preparation is the same as for a jybot run, but there is
- no need to install anything besides SikuliX via a valid setup with Jython selected
- no need to specify anything in the environment (no classpath, jythonpath or whatever)

it simply works out of the box ;-)

---------------------------------------------------------------------
I am trying to integrate Sikuli 1.1.1 nightly build with robot framework 3.0

I am following the question https://answers.launchpad.net/sikuli/+question/261208

My config:

Python:2.7
Jython: jython2.7b3
Robot Framework 3.0

My jybot.bat file:

I have everything in c:/RFW folder , i mean all the jar files like sikulix.jar and stuff like explained in the previous example.

@echo off
setlocal
set ROBOT_HOME=%~dp0
set JYTHON_HOME=%ROBOT_HOME%
set SIKULIX_HOME=%ROBOT_HOME%

set CLASSPATH=%SIKULIX_HOME%sikulixapi.jar;%CLASSPATH%
set JYTHONPATH=%SIKULIX_HOME%sikulixapi.jar\Lib

java -cp %JYTHON_HOME%jython.jar;%CLASSPATH% org.python.util.jython ^
  %ROBOT_HOME%robot\run.py ^
  --pythonpath=%ROBOT_HOME%calc.sikuli ^
  %*
endlocal

When I execute my jybot.bat file by typing

jybot.bat verify_operations.txt in command line I get the following error.

C:\RFW>jybot.bat verify_operations.txt
  File "C:\RFW\robot\run.py", line 433
SyntaxError: 'with' will become a reserved keyword in Python 2.6

I dont understand what to do.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

have a look here for the first steps without extra effort:
http://sikulix-2014.readthedocs.io/en/latest/scenarios.html#using-robotframework

Revision history for this message
Shobin (shobinwind) said :
#2

Thank you RaiMan, Sorry to ask such a basic question but I am trying out the calculator example from mike's blog.

and i have the calc.sikuli folder and everything , according to the post which you just shared .

step1: I opened Sikuli and paster this

runScript("""
robot
*** Variables ***
${USERNAME} demo
${PASSWORD} mode
${TESTSITE} http://test.sikuli.de
*** Settings ***
Library ./inline/LoginLibrary
Test Setup start firefox and goto testsite ${TESTSITE}
Test Teardown stop firefox
*** Test Cases ***
User can log in with correct user and password
    Attempt to Login with Credentials ${USERNAME} ${PASSWORD}
    Status Should Be Accepted
User cannot log in with invalid user or bad password
    Attempt to Login with Credentials betty wrong
    Status Should Be Denied
""")

class LoginLibrary(object):
  def start_firefox_and_goto_testsite(self, page):
    popup("start_firefox_and_goto_testsite")
  def stop_firefox(self):
    popup("stop_firefox")
  def attempt_to_login_with_credentials(self, username, password):
    popup("attempt_to_login_with_credentials")
  def status_should_be(self, expected):
    popup("status_should_be")

and executed , it shows error the no module name robot.

Revision history for this message
Shobin (shobinwind) said :
#3

I also tried to modify it like this but still same error.

runScript("""
robot
***Settings***
Library calc.Calculator WITH NAME Calculator

***Test Cases***
Verify that 2 + 2 = 4
 Start App
 Verify App
 Perform Action 2 + 2
 Verify Result 4

Verify that 2 + 2 = 5
 Start App
 Verify App
 Perform Action 2 + 2
 Verify Result 5

Click on non-existent button "Exp"
 Start App
 Verify App
 Perform Action 2 exp 2
 Verify Result 2""")

Revision history for this message
Shobin (shobinwind) said :
#4

I also tried to modify it like this but still same error.

runScript("""
robot
***Settings***
Library calc.Calculator WITH NAME Calculator

***Test Cases***
Verify that 2 + 2 = 4
 Start App
 Verify App
 Perform Action 2 + 2
 Verify Result 4

Verify that 2 + 2 = 5
 Start App
 Verify App
 Perform Action 2 + 2
 Verify Result 5

Click on non-existent button "Exp"
 Start App
 Verify App
 Perform Action 2 exp 2
 Verify Result 2""")

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

have you run setup with the build 1.1.1 2016-05-20_13:31nightly ?

take care, that your environment do not point to anything, that you might think is needed for SikuliX: there is nothing else needed than a correct clean setup.

Revision history for this message
Shobin (shobinwind) said :
#6

I have Run with the build 1.1.1 2016-05-19

Clean install using netbeans maven build.

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

ok, then you have to pull the today's git, run clean install and test again.

Revision history for this message
Shobin (shobinwind) said :
#8

Did that just now, Still not working :-(

Revision history for this message
Shobin (shobinwind) said :
#9

Can you tell me how to make the calc.py example work in the latest version of the tool.

Like the below example:

 http://sikulix-2014.readthedocs.io/en/latest/scenarios.html#using-robotframework.

Danke Herr

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

sorry, but that is your job.

as a first step you should get familiar with the RobotFramework concepts of keywords implemented in P(J)ython without using Sikuli.

then you will be able to adapt the above mentioned SikuliX support.
I think the docs are clear enough.

Revision history for this message
Shobin (shobinwind) said :
#11

Thank you for response.

I erased everything and started from the beginning.

I got my "with is not part of python 2.6" issue resolved by using the robot directory of RFW3.0

Now when i run my jybottest.bat file i get nothing, nothing happens on screen in the command prompt. The cursor returns to the original position with no updated.

@echo off
setlocal
set ROBOT_HOME=%~dp0
set JYTHON_HOME=%ROBOT_HOME%
set SIKULIX_HOME=%ROBOT_HOME%

set CLASSPATH=%SIKULIX_HOME%sikulixapi.jar;%CLASSPATH%
set JYTHONPATH=%SIKULIX_HOME%sikulixapi.jar\Lib

java -cp %JYTHON_HOME%jython.jar;%CLASSPATH% org.python.util.jython ^
  %ROBOT_HOME%robot\run.py ^
  --pythonpath=%ROBOT_HOME%calc.sikuli ^
  --outputdir=result ^
  --loglevel=TRACE ^
  %*
endlocal

This is my jybottest file.

I am puzzled as to why nothing is being displayed.

Revision history for this message
Shobin (shobinwind) said :
#12

This is how my command line looks like

C:\RFW>jybottest.bat verify_operations.txt

C:\RFW>

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

ok, but that is not according to my recommendation in comment #9.

I will check later, how the stony way you have chosen could be used.

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

I strongly recommend to again read through the docs:
http://sikulix-2014.readthedocs.io/en/latest/scenarios.html#using-robotframework

I made some minor revisions, so even the case
import robot.run
robot.run("path-to-script.robot", outputdir="somepath")

now works in all cases.

The outside preparation here is the same as for a jybot run, but there is
- no need to install anything besides SikuliX via a valid setup with Jython selected
- no need to specify anything in the environment (no classpath, jythonpath or whatever)

it simply works out of the box ;-)

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

ok, you need the latest nightly build or the actual state from github.

Revision history for this message
Shobin (shobinwind) said :
#16

Ok, Will give it a shot , Thank you.

Revision history for this message
Shobin (shobinwind) said :
#17

I downloaded the latest nightly build 5/24 and ran the test code which you have provided.

runScript("""
robot
*** Variables ***
${USERNAME} demo
${PASSWORD} mode
${TESTSITE} http://test.sikuli.de
*** Settings ***
Library ./inline/LoginLibrary
Test Setup start firefox and goto testsite ${TESTSITE}
Test Teardown stop firefox
*** Test Cases ***
User can log in with correct user and password
    Attempt to Login with Credentials ${USERNAME} ${PASSWORD}
    Status Should Be Accepted
User cannot log in with invalid user or bad password
    Attempt to Login with Credentials betty wrong
    Status Should Be Denied
""")

class LoginLibrary(object):
  def start_firefox_and_goto_testsite(self, page):
    popup("start_firefox_and_goto_testsite")
  def stop_firefox(self):
    popup("stop_firefox")
  def attempt_to_login_with_credentials(self, username, password):
    popup("attempt_to_login_with_credentials")
  def status_should_be(self, expected):
    popup("status_should_be")

This is giving me all the pop ups that you have defined in the python code. So basically this is working , doesn't need anything else. This is MUCH MUCH more convenient than the older setup which was a pain.

My issue is resolved now.

Danke RaiMan

Revision history for this message
Shobin (shobinwind) said :
#18

Thanks RaiMan, that solved my question.