[1.0.1] Sikuli integration Robot framework --- use sikuli-java.jar
Hello RaiMan.
I hope you can help me :)
Currently I try to follow the instructions on http://
I managed to run a sikuli script from line command and now now I'm blocked with the integration with Robot Framework.
Here is the information on my system:
- Windows 7 64 bits
- Java runtime environment : JAVA_VERSION=
- Jython 2.5.1 (I tried also with 2.5.3)
- Python 2.7.6
- Robot Framework 2.5.5 (Itried also with 2.8.1)
- SikuliX Setup Build: 1.0.1 12NOV2013120000
My robottest.bat looks like the following:
@echo off
set sikuli_
java -cp "%sikuli_jar%" ^
-Dpython.
-jar robotframework-
--pythonpath=
--outputdir
--loglevel=
%*
When I run it, I get following message:
C:\work\
[ ERROR ] Invalid syntax in file 'c:\work\
ns.txt' in table 'Settings': Importing test library 'calc.Calculator' failed: Im
portError: No module named calc
PYTHONPATH: ['C:\\work\
ies', 'C:\\work\
p1\\Lib', 'C:\\work\
, '__pyclasspath__/', '.']
CLASSPATH: robotframework-
Traceback (most recent call last):
File "C:\work\
.class", line 94, in _import
=======
Verify Operations
=======
Verify that 2 + 2 = 4 | FAIL |
No keyword with name 'Start App' found.
-------
Verify Operations | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
=======
Output: c:\work\
Report: c:\work\
Log: c:\work\
C:\work\calc_step1>
I was that someone got the same issue but I didn't see well how it was resolved.
I tried a lot of things...I think there may be an issue with the version of Jython or Python or something with the classpath.
So thanks to help me .
See you
Grégory
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
|
#1 |
When using RFW, you generally have to use sikuli-java.jar (1.0.1) or sikulixapi.jar (1.1.0), since sikuli-ide.jar or sikuli-script.jar (1.0.1) contain a Jython 2.5.4 (1.1.0 sikulix.jar contains Jython 2.7), which conflicts on sys.path with the used external Jython by RFW.
So with 1.0.1 run setup again and select option 4 to get a sikuli-java.jar.
More info:
https:/
I will contact Mike and ask him to update his blogpost, when I am ready with version 1.1.0.
Revision history for this message
|
#2 |
I setup again 1.0.1 and got sikuli-java.jar
But now when i run testrun.bat I got the folowing message : no main manifest attribute, in sikuli-java.jar
Revision history for this message
|
#3 |
I added 'Main-Class: org.sikuli.
then run 'java -jar sikuli-java.jar -r test.sikuli' from cmd.
and I got the following exception :
C:\work\
Exception in thread "main" java.util.
s.IScriptRunner: Provider org.sikuli.
at java.util.
at java.util.
at java.util.
at java.util.
at org.sikuli.
at org.sikuli.
at org.sikuli.
at org.sikuli.
Revision history for this message
|
#4 |
sikuli-java.jar is not runnable and cannot run scripts, because it does not contain Jython. But that's the intention ;-)
To run your script, you have to use the external Jython that you should have and put sikuli-java.jar on the class path.
Revision history for this message
|
#5 |
I'm a little lost,
So I come back to robottest.bat.
I removed sikuli-script.jar and put sikuli-java.jar instead
I got the Lib library from sikuli-java.jar
But I have the same error as before when I used sikuli-script.jar
I added sikuli-java.jar in path
C:\work\
[ ERROR ] Invalid syntax in file 'c:\work\
ns.txt' in table 'Settings': Importing test library 'calc.Calculator' failed: Im
portError: No module named calc
PYTHONPATH: ['C:\\work\
ies', 'C:\\work\
p1\\Lib', 'C:\\work\
, '__pyclasspath__/', '.']
CLASSPATH: robotframework-
Traceback (most recent call last):
File "C:\work\
.class", line 94, in _import
=======
Verify Operations
=======
Verify that 2 + 2 = 4 | FAIL |
No keyword with name 'Start App' found.
-------
Verify Operations | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
=======
Output: c:\work\
Report: c:\work\
Log: c:\work\
in fact, usage of sikuli-script.jar instead of sikuli-java.jar doesn't seem to change something
Here what I see in path (environment variable) , maybe it can help :
C:\Program Files (x86)\Java\
Revision history for this message
|
#6 |
I 'm currently trying something else.
From robotsuite_
*** Settings ***
Library calc.Calculator WITH NAME Calculator
and I got the previous error :
[ ERROR ] Invalid syntax in file 'c:\work\
ns.txt' in table 'Settings': Importing test library 'calc.Calculator' failed: Im
portError: No module named calc
Now i put the path of calc.py in verify_
*** Settings ***
Library C:/work/
and I got foolowing error :
C:\work\
[ ERROR ] Invalid syntax in file 'c:\work\
ns.txt' in table 'Settings': Importing test library 'calc' failed: ImportError:
No module named sikuli
PYTHONPATH: [u'c:\\
ramework-
k-2.5.5.jar\\Lib', 'C:\\work\
ework-2.
CLASSPATH: robotframework-
Traceback (most recent call last):
File "C:\work\
.class", line 94, in _import
File "c:\work\
from sikuli.Sikuli import *
File "C:\work\
from org.sikuli.basics import Debug
But at least the calc.py module is found
Revision history for this message
|
#7 |
according to the RFW docs this should do the job:
java -Xbootclasspath
BTW: the Windows system path has nothing to do with that.
none of these should have any effect and hence do not make sense:
C:\work\
Revision history for this message
|
#8 |
Now in my robottest.bat, I put this :
@echo off
java -Xbootclasspath
I removed what it is not needed in path environment variable
In verify_
*** Settings ***
Library C:/work/
*** Test Cases ***
Verify that 2 + 2 = 4
Start App
Verify App
Perform Action 2 + 2
Verify Result 4
when I launch robottest.bat, it goes further :
C:\work\
=======
Verify Operations
=======
[ ERROR ] Invalid syntax in file 'c:\work\
ns.txt' in table 'Settings': Importing test library 'calc' failed: TypeError: lo
g(): 1st arg can't be coerced to String
PYTHONPATH: [u'c:\\
ramework-
rk\\calc_
_/', '.']
CLASSPATH: robotframework-
Traceback (most recent call last):
File "C:\work\
.class", line 88, in _import
File "C:\work\
.class", line 88, in _import
File "c:\work\
from sikuli.Sikuli import *
File "C:\work\
Debug.
Verify Operations.Verify Operations
May I need to put in comment all lines begining by " Debug.log(3, " in sikuli.py and __init__.py
I try also with the last robotframework version : 2.8.5
C:\work\
C:\work\calc_step1>
Revision history for this message
|
#9 |
--- May I need to put in comment all lines begining by " Debug.log(3, " in sikuli.py and __init__.py
surely not!!!
I will test now myself and hope to came back with the solution shortly.
Revision history for this message
|
#10 |
I added -Dsikuli.Debug=3 to have more information when I run with robotframework 2.8.1 or 2.8.5
and I got the following message
C:\work\
[ ERROR ] Parsing 'run' failed: Data source does not exist. Maybe the verify_
so currently I keep 2.5.5 version
Revision history for this message
|
#11 |
Ok, this works for me (using variables to make it better readable:
the general java command is:
java -cp sikuli-
where the items have to be adjusted system specific.
Nothing is needed in system path and the Lib folder need not be unpacked with SikuliX version 1.0.1+ (see below)
on Windows make a bat/cmd:
setlocal
set sikuli=<path to sikuli-java.jar>
set rfw=<path to robotframework.jar>
set clp=%sikuli%;%rfw%
java -cp "%clp%" -Dsikuli.Debug=3 org.robotframew
endlocal
in your .sikuli library you need the following at the beginning:
import org.sikuli.
from sikuli import *
--- to see the full debug output:
import org.sikuli.
Dbg.setLogFile("") # Sikuli's debug messages go here: SikuliLog.txt
import org.sikuli.
from sikuli import *
Debug.setUserLo
Debug.user("after sikuli has started")
for e in sys.path: Debug.user( e)
Revision history for this message
|
#12 |
Hi RaiMan,
I try with your modifications but it is failed again. But maybe I have more information to give you due to Debug mode.
Just one thing to check before , I would like to be sure about the verify_
*** Settings ***
Library C:/work/
*** Test Cases ***
Verify that 2 + 2 = 4
Start App
Verify App
Perform Action 2 + 2
Verify Result 4
Now my robottest.bat looks like :
@echo off
setlocal
set sikuli=
set rfw=C:\
set clp=%sikuli%;%rfw%
java -cp "%clp%" -Dsikuli.Debug=3 org.robotframew
endlocal
and calc.py begins with :
from __future__ import with_statement
#import org.sikuli.
#from sikuli import *
import org.sikuli.
Dbg.setLogFile("") # Sikuli's debug messages go here: SikuliLog.txt
import org.sikuli.
from sikuli import *
Debug.setUserLo
Debug.user("after sikuli has started")
for e in sys.path: Debug.user( e)
#from sikuli.Sikuli import *
addImagePath(
class Calculator(object):
I remove Lib directory too
So I launch robottest.bat and here is below the result :
C:\work\
=======
Verify Operations
=======
[ ERROR ] Invalid syntax in file 'c:\work\
ns.txt' in table 'Settings': Importing test library 'calc' failed: TypeError: lo
g(): 1st arg can't be coerced to String
PYTHONPATH: [u'c:\\
ramework-
rk\\calc_
_/', '.', 'C:\\work\
CLASSPATH: C:\work\
2.5.5.jar
Traceback (most recent call last):
File "C:\work\
.class", line 88, in _import
File "C:\work\
.class", line 88, in _import
File "c:\work\
from sikuli import *
File "C:\work\
module>
Verify Operations.Verify Operations
and in sikuliLog.txt:
[debug] Debug: setLogFile: C:/work/
[debug] SikuliXforJython: sys.path[0]: c:\work\
[debug] SikuliXforJython: sys.path[1]: C:\work\
[debug] SikuliXforJython: sys.path[2]: C:\work\
[debug] SikuliXforJython: sys.path[3]: C:\work\
[debug] SikuliXforJython: sys.path[4]: __classpath__
[debug] SikuliXforJython: sys.path[5]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[6]: .
[debug] SikuliXforJython: found Sikuli Jython in:
/C:/work/
[debug] SikuliXforJython: Trying to add to sys.path
[debug] SikuliXforJython: new Jython path:
[debug] SikuliXforJython: sys.path[0]: c:\work\
[debug] SikuliXforJython: sys.path[1]: C:\work\
[debug] SikuliXforJython: sys.path[2]: C:\work\
[debug] SikuliXforJython: sys.path[3]: C:\work\
[debug] SikuliXforJython: sys.path[4]: __classpath__
[debug] SikuliXforJython: sys.path[5]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[6]: .
[debug] SikuliXforJython: sys.path[7]: /C:/work/
[debug] ResourceLoaderB
Then I tried also with robotframework-
[debug] Debug: setLogFile: C:/work/
[debug] SikuliXforJython: sys.path[0]: C:\work\
[debug] SikuliXforJython: sys.path[1]: C:\work\
[debug] SikuliXforJython: sys.path[2]: C:\work\
[debug] SikuliXforJython: sys.path[3]: C:\work\
[debug] SikuliXforJython: sys.path[4]: __classpath__
[debug] SikuliXforJython: sys.path[5]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[6]: .
[debug] SikuliXforJython: sys.path[7]: C:\work\calc_step1
[debug] SikuliXforJython: found Sikuli Jython in:
/C:/work/
[debug] SikuliXforJython: Trying to add to sys.path
[debug] SikuliXforJython: new Jython path:
[debug] SikuliXforJython: sys.path[0]: C:\work\
[debug] SikuliXforJython: sys.path[1]: C:\work\
[debug] SikuliXforJython: sys.path[2]: C:\work\
[debug] SikuliXforJython: sys.path[3]: C:\work\
[debug] SikuliXforJython: sys.path[4]: __classpath__
[debug] SikuliXforJython: sys.path[5]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[6]: .
[debug] SikuliXforJython: sys.path[7]: C:\work\calc_step1
[debug] SikuliXforJython: sys.path[8]: /C:/work/
[debug] ResourceLoaderB
[debug] Jython: sikuli: __init__: entering
[debug] Jython: sikuli: Sikuli: entering
[debug] Jython: sikuli: Sikuli: constants
[debug] Jython: sikuli: Sikuli: import Region
[debug] Jython: sikuli: Sikuli: import Screen
[debug] Jython: sikuli: Sikuli: Env.addHotkey
[debug] Jython: sikuli: Sikuli: import Match
[debug] Jython: sikuli: Sikuli: import Pattern
[debug] Jython: sikuli: Sikuli: import Location
[debug] Jython: sikuli: Sikuli: import ScreenUnion
[debug] Jython: sikuli: Sikuli: import Finder
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[error] ResourceLoaderB
[action] ResourceLoaderB
[debug] ResourceLoaderB
[info] runcmd: reg QUERY HKCU
[debug] ResourceLoaderB
[info] runcmd: reg QUERY HKEY_CURRENT_
[debug] ResourceLoaderB
[error] ResourceLoaderB
[error] Terminating SikuliX after a fatal error! Sorry, but it makes no sense to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.
[debug] SikuliXFinal: cleanUp: 0
I don't understand why I have this line :
[debug] SikuliXforJython: sys.path[3]: C:\work\
because I remove the Lib directory
Revision history for this message
|
#13 |
ok, nearly there:
--- I don't understand why I have this line :
This is standard behavior, just ignore it (it is no problem, if it does not exist - and it should not exist!)
… and then just do what is said:
Logout and Login again!
with version 1.0.1 you still have to restart your session/machine after the first usage of the sikuli…-jars.
This is fixed in 1.1.0
I recommend, to go with 2.8.5, since I will use that too (… and will add an option to auto-setup), so I could help you easier.
Revision history for this message
|
#14 |
Yes sorry, I've just been thinking to log out/ log in and it is better ...
So with robotframework-
[debug] Debug: setLogFile: C:/work/
[debug] SikuliXforJython: sys.path[0]: C:\work\
[debug] SikuliXforJython: sys.path[1]: C:\work\
[debug] SikuliXforJython: sys.path[2]: C:\work\
[debug] SikuliXforJython: sys.path[3]: C:\work\
[debug] SikuliXforJython: sys.path[4]: __classpath__
[debug] SikuliXforJython: sys.path[5]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[6]: .
[debug] SikuliXforJython: sys.path[7]: C:\work\calc_step1
[debug] SikuliXforJython: found Sikuli Jython in:
/C:/work/
[debug] SikuliXforJython: Trying to add to sys.path
[debug] SikuliXforJython: new Jython path:
[debug] SikuliXforJython: sys.path[0]: C:\work\
[debug] SikuliXforJython: sys.path[1]: C:\work\
[debug] SikuliXforJython: sys.path[2]: C:\work\
[debug] SikuliXforJython: sys.path[3]: C:\work\
[debug] SikuliXforJython: sys.path[4]: __classpath__
[debug] SikuliXforJython: sys.path[5]: __pyclasspath__/
[debug] SikuliXforJython: sys.path[6]: .
[debug] SikuliXforJython: sys.path[7]: C:\work\calc_step1
[debug] SikuliXforJython: sys.path[8]: /C:/work/
[debug] ResourceLoaderB
[debug] Jython: sikuli: __init__: entering
[debug] Jython: sikuli: Sikuli: entering
[debug] Jython: sikuli: Sikuli: constants
[debug] Jython: sikuli: Sikuli: import Region
[debug] Jython: sikuli: Sikuli: import Screen
[debug] Jython: sikuli: Sikuli: Env.addHotkey
[debug] Jython: sikuli: Sikuli: import Match
[debug] Jython: sikuli: Sikuli: import Pattern
[debug] Jython: sikuli: Sikuli: import Location
[debug] Jython: sikuli: Sikuli: import ScreenUnion
[debug] Jython: sikuli: Sikuli: import Finder
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] ResourceLoaderB
[debug] Jython: sikuli: Sikuli: import App
[debug] ResourceLoaderB
[debug] Screen: initScreens: basic initialization (1 Screen(s) found)
[debug] *** monitor configuration (primary: 0) ***
[debug] Screen 0: S(0)[0,0 1280x1024]
[debug] *** end monitor configuration ***
[debug] Jython: sikuli: Sikuli: import Key
[debug] Jython: sikuli: Sikuli: import from Basics
[debug] Jython: sikuli: Sikuli: import from compare
[debug] Jython: sikuli: Sikuli: init SikuliImporter
[debug] Jython: sikuli: Sikuli: import SikuliScript
[debug] Jython: init SCREEN as ()
[debug] Debug: setLogFile: C:/work/
Revision history for this message
|
#15 |
ok, then you should now switch off the logging and try to run your test:
in calc you only need the 2 lines at the beginning
import org.sikuli.
from sikuli import *
addImagePath(
needs a complete absolute path to work.
In your case, this should work:
addImagePath(
since the first entry seems to contain the absolute path to calc.sikuli.
a more general solution would be:
scriptName = "calc.sikuli"
for e in sys.path:
if e.endswith(
Revision history for this message
|
#16 |
Ok I modified as you said.
I think now that a resource is missing :
C:\work\
=======
Verify Operations
=======
Verify that 2 + 2 = 4 | FAIL |
User keyword 'Start App' contains no keywords.
-------
Verify Operations | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
=======
Output: C:\work\
Log: C:\work\
Report: C:\work\
I tried from Robot IDE, and I got this error :
unexpected error: [ ERROR ] Parsing 'robot_
Revision history for this message
|
#17 |
ok, now you have to bring back Mike's content to calc.py.
Revision history for this message
|
#18 |
in calc.py it is the Mike's content but what I don't understand is the following:
in calc.py I see :
def startApp(self):
calcApp = App("Calculator")
if not calcApp.window():
but in verify_
*** Test Cases ***
Verify that 2 + 2 = 4
Start App
So I don't know how the link can can be done from "Start App" and startApp
Revision history for this message
|
#19 |
This is RFW specific how to deal with such strings.
As far as I understood, you have some freedom about what you write and RFW will try to find the target (startApp() in this case).
But there are some rules: you have to contact the RFW docs about that.
I cannot test it with this example, since I do not want to setup RFW on my Windows. For what I want to do, having it working on Mac is sufficient for me.
I recommend, to just make a simpler example and verify, that it principally works.
Revision history for this message
|
#20 |
this test.txt works for me
*** Settings ***
Library stuff/calc.
*** Test Cases ***
Verify that 2 + 2 = 4
Start App
Verify App
Perform Action 2 + 2
Verify Result 4
you have to obey the rules for the tabular character of the stuff in txt format.
with this calc.py
import org.sikuli.
from sikuli import *
popup("
def startApp():
popup("startApp")
def verifyApp():
popup(
def performAction(
popup(
def verifyResult(
popup(
I have no time, to check, why the def's are not found, when wrapped in a class.
Revision history for this message
|
#21 |
uups it has stollen the additional blanks:
one dot means one blank (as far as I remember: at least 2 blanks proceed to the next column
*** Test Cases ***
Verify that 2 + 2 = 4
Start App
Verify App
Perform Action….2….+….2
Verify Result….4
Revision history for this message
|
#22 |
I agree with you , it works with your calc.py simplified :) . It is the first time since few days I see a PASS
But yes, it seems that there is an issue with the classes are wrapped in a class
Revision history for this message
|
#23 |
in calc.py I modified this :
class Calculator(object): replaced by class calc(object):
...
...
...
if __name__ == "__main__":
calc = Calculator() replaced by calc = calc()
and it works :
C:\work\
=======
Verify Operations
=======
Verify that 2 + 2 = 4 | PASS |
-------
Verify Operations | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
=======
Output: C:\work\
Log: C:\work\
Report: C:\work\
Revision history for this message
|
#24 |
ok, now I got the secret behind all this:
- if you want to use a class inside a module, then the class name has to be the same as the module name (without the .py and/or the .sikuli) - and this is case sensitive. If this is not the case (module name != class name), then there are more options to specify the class to be loaded.
- if you use the library specification in Settings with a folder structure like folder/
Taking this all together, then this is a valid example:
*** Settings ***
Library…
*** Test Cases ***
Verify that 2 + 2 = 4
Start App
Verify App
Perform Action….2….+….2
Verify Result….4
with this Calculator.sikuli:
import org.sikuli.
from sikuli import *
popup("
class Calculator:
def __init__(self):
popup(
def startApp(self):
popup(
def verifyApp(self):
popup(
def performAction(self, *args):
popup(
def verifyResult(self, *args):
popup(
def runAllTests(self):
self.startApp()
self.
self.
self.
# ---- this is ignored when imported
# ---- makes this runnable for testing outside RFW
if __name__ == "__main__":
Calculator(
… and this simply does what it should.
Revision history for this message
|
#25 |
Thank you Raiman for your precious help and your very good support.
I'm now ready to test with Sikuli and RobotFRW
See you later for a new question :)
Greg
Revision history for this message
|
#26 |
Thanks RaiMan, that solved my question.
Revision history for this message
|
#27 |
Thank you also:
you finally "convinced" me, to add some support for RFW into Sikuli.
It fits very well as some testing framework and on the JRuby side, I will add support for RSpec and Cucumber as well.
You will be able to directly edit your test in the IDE, provide the needed Sikuli libraries and other stuff and then run your test.
This will be added as an option with setup: I want to use Testing frameworks.
all the best and happy testing.
Revision history for this message
|
#28 |
Hi Greg/Raiman,
We are also seeing the same issues that you have seen while running robot test. From last three days We are trying to fix those errors. But we are unable to fix. Since lot of thread there above, we are unable to follow the things that worked for you.
Could you please provide the settings/files that worked for you.
It will be helpful if you provide the following details step-by-step:
STEP 1. Calc.py
STEP 2. Verify_
STEP 3. Jar files details
STEP 4. PATH setting details
STEP 5. Command you are using to run the test.
It will be really helpful if you provide us the above details.
Thanks a lot in advance.
Thanks,
Balu.
Revision history for this message
|
#29 |
@balu
the current discussion takes place in the original post
http://
Revision history for this message
|
#30 |
Hi RaiMan,
Thanks for your reply.
Followed this steps that Tset suggested. But still I am getting some errors. Could you please help me to fix this.
Below is my current situation:
STEP 1 :
My Calc.py contents:
=================
# -*- coding: utf-8 -*-
from __future__ import with_statement
# IMPORTANT: python level import - don´t mix it with java level imports of Sikuli classes
# like from org.sikuli.script import Region
# For more details go here: https:/
from sikuli import *
setBundlePath(
s = Screen()
class Calculator(object):
def __init__(self):
self.
def startApp(self):
calcApp = App("Calculator")
if not calcApp.window():
App.
s.wait(2)
calcApp.focus()
s.wait(1)
def verifyApp(self):
# check application
if s.exists(
print("PASS: Calculator window appeared")
else:
print("FAIL: No calculator window")
def performAction(self, *args):
# get application region
s.find(
match = s.getLastMatch()
self.
appRegion = Region(
# rewrite action
action = args[1]
if args[1] == '+':
action = 'Plus'
elif args[1] == 'exp':
action = 'Exp'
# with appRegion:
s.click(
s.click( "btn%s.png" % (args[0],) )
s.click( "btn%s.png" % (action,) )
s.click( "btn%s.png" % (args[2],) )
s.click(
def verifyResult(self, *args):
expected_result = str(eval(
actual_result = self.getResultF
#verification
print expected_result
print actual_result
if actual_result == expected_result:
print("PASS: Action performed correctly and result equals %s" % expected_result)
else:
print("FAIL: Actual result '%s' is not equal to expected result '%s'" % (actual_result, expected_result))
def getResultFromCl
type('c', KEY_CTRL)
return str(Env.
def runTest(self):
self.startApp()
self.verifyApp()
actions = '2+2'
self.
self.
if __name__ == "__main__":
calc = Calculator()
calc.runTest()
STEP 2: Verify_
=======
***Settings***
#Library calc.Calculator WITH NAME Calculator
Library C:/Users/
***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
STEP 3: robottest.bat contents:
=======
@echo off
set sikulix_
set robot_framework
java -cp "%robot_
-Dpython.
org.
--
--
--
%*
STEP 4:
When I run I am getting following error:
C:\Users\
y_operations.txt
Exception in thread "main" Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\
ork-2.5.
File "C:\jython2.
raise ImportError, 'no os specific module found'
ImportError: no os specific module found
C:\Users\
I am using "Windows7 32bit".
CLASSPATH : C:\robot\
JYTHONPATH : C:\jython2.
SIKULIX_HOME : C:\robot\
Could you please help me to fix this issue. Thanks for your help.
Thanks,
Balu.
Revision history for this message
|
#31 |
seems to be some combined problem of Windows7 32bit + robotframework-
So as a first step you should try with the latest robot framework
If this does not help, you might try with Jython 2.7 (which in turn needs to upgrade to Java 7)
If this does not help, you either have to say good bye to robot framework ;-) (hope you get it solved though)
… definitely not a SikuliX problem.
Revision history for this message
|
#32 |
Hi RaiMan,
I have used "robotframework
Its throwing following erro:
C:\Users\
y_operations.txt
[ ERROR ] Error in file 'C:\Users\
ikuli\verify_
top/Projects/Sikuli Projects/
=======
Verify Operations
=======
Verify that 2 + 2 = 4 | FAIL |
No keyword with name 'Start App' found.
-------
Verify that 2 + 2 = 5 | FAIL |
No keyword with name 'Start App' found.
-------
Verify Operations | FAIL |
2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
=======
Output: C:\Users\
tput.xml
Log: C:\Users\
g.html
Report: C:\Users\
port.html
C:\Users\
Thanks,
Balu.
Revision history for this message
|
#33 |
ok, fine, then now it principally works.
It seems you have to revise your project structure and either adapt this or the Library setting in verify_
… but this is basic RobotFrameWork knowledge ;-)
Revision history for this message
|
#34 |
Hi Raiman,
Thanks for your reply.
I tried to use both the following one by one in verify_
Library calc.Calculator WITH NAME Calculator
Library C:/Users/
but still I am getting following error:
C:\Users\
y_operations.txt
[ ERROR ] Error in file 'C:\Users\
ikuli\verify_
mportError: No module named sikuli
Traceback (most recent call last):
File ".\calc.py", line 7, in <module>
from sikuli import *
File "C:\Users\
__init__.py", line 3, in <module>
from Sikuli import *
File "C:\Users\
Sikuli.py", line 10, in <module>
from org.sikuli.script import SikuliScript
PYTHONPATH:
C:\Users\
8.5.jar\
C:\Users\
8.5.jar\Lib
C:\jython2.
C:\Users\
__classpath__
__pyclasspath__/
.
C:\Users\
CLASSPATH:
C:\Users\
8.5.jar
C:\robot\
=======
Verify Operations
=======
Verify that 2 + 2 = 4 | FAIL |
No keyword with name 'Start App' found.
-------
Verify that 2 + 2 = 5 | FAIL |
No keyword with name 'Start App' found.
-------
Verify Operations | FAIL |
2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
=======
Output: C:\Users\
tput.xml
Log: C:\Users\
g.html
Report: C:\Users\
port.html
C:\Users\
Could you please give me a idea to fix this.
Thanks in advance.
Revision history for this message
|
#35 |
Hi RaiMan,
Could you please look into the above error.
I am new to RFW and Sikuli. I am unable to fix this error.
Please guide me on this.
Thanks,
Balu
Revision history for this message
|
#36 |
Hi RaiMan,
I am suspecting issue in "pathonpath" in my robottest.bat . I have installed python in "C:\Python27". Should I refer this is python installation path?
@echo off
set sikulix_
set robot_framework
java -cp "%robot_
-Dpython.
org.
--
--
--
%*
I tried with python installtion path. But still I am getting same error.
Please guide me on this.
Revision history for this message
|
#37 |
Hi RaiMan,
I tried the example given in "http://
C:\Users\
robot
=======
Test
=======
Example that calls a python keyword | PASS |
-------
Test | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
=======
Output: C:\Users\
tput.xml
Log: C:\Users\
g.html
Report: C:\Users\
port.html
So. There is no problem with PYTHONPATH right?
I am seeing issue when I use "calc.py" as Library. Here its throwing some sikuli related errors as shown below:
C:\Users\
y_operations.txt
[ ERROR ] Error in file 'C:\Users\
ikuli\verify_
ojects\Sikuli Projects\
sikuli
Traceback (most recent call last):
File "C:\Users\
ine 7, in <module>
from sikuli import *
File "C:\Users\
__init__.py", line 3, in <module>
from Sikuli import *
File "C:\Users\
Sikuli.py", line 10, in <module>
from org.sikuli.script import SikuliScript
PYTHONPATH:
C:\Users\
8.5.jar\
C:\Users\
8.5.jar\Lib
C:\jython2.
C:\Users\
__classpath__
__pyclasspath__/
.
C:\Python27\Lib
CLASSPATH:
C:\Users\
8.5.jar
C:\robot\
=======
Verify Operations
=======
Verify that 2 + 2 = 4 | FAIL |
No keyword with name 'Start App' found.
-------
Verify that 2 + 2 = 5 | FAIL |
No keyword with name 'Start App' found.
-------
Verify Operations | FAIL |
2 critical tests, 0 passed, 2 failed
2 tests total, 0 passed, 2 failed
=======
Output: C:\Users\
tput.xml
Log: C:\Users\
g.html
Report: C:\Users\
port.html
C:\Users\
Could you please look into this?
Thanks in advance.
Revision history for this message
|
#38 |
Thanks Raiman,
I am following-up in my own question in :
https:/
Thanks,
Balu