Integrating Groovy and Robot framework.

609 views
Skip to first unread message

swamy

unread,
Mar 22, 2011, 6:23:39 AM3/22/11
to robotframework-users
Hi,

I'm new to robot framework. I'm working on web services project and
required to make robot framework to import test libraries written in
groovy language. However I'm not able to do that and I'm getting
following error while trying to import test library
"ProxyTest.groovy": [ ERROR ] Invalid syntax in file 'c:\users\admin
\desktop\proxy1\proxy.html' in table 'Setting': Importing test library
'ProxyTest' failed: ImportError: No module named ProxyTest


Please help me out from this issue.

Regards,
Swamy

AndreasEK

unread,
Mar 22, 2011, 5:22:15 PM3/22/11
to robotframework-users
Hi,

you have to pass the class name as parameter to the Library setting.
So my first recommandation is to skip the ".groovy" just import
"ProxyTest".

Andreas

Pekka Klärck

unread,
Mar 22, 2011, 6:12:49 PM3/22/11
to swamysh...@gmail.com, robotframework-users
2011/3/22 swamy <swamysh...@gmail.com>:

>
> I'm new to robot framework.

Welcome aboard!

> I'm working on web services project and
> required to make robot framework to import test libraries written in
> groovy language. However I'm not able to do that and I'm getting
> following error while trying to import test library
> "ProxyTest.groovy": [ ERROR ] Invalid syntax in file 'c:\users\admin
> \desktop\proxy1\proxy.html' in table 'Setting': Importing test library
> 'ProxyTest' failed: ImportError: No module named ProxyTest

Do I get it right that the library you try to use is implemented with
Groovy? If so, then this unfortunately isn't going to work directly as
only Python and Java (requires Jython) can be used to write libraries
natively. Other languages can be used via these libraries and, because
Groovy runs on JVM, it ought to be possible to write a library with
Java and call Groovy from there. An other idea is using the remote
library interface [1] but that requires writing a Groovy remote server
first.

[1] http://code.google.com/p/robotframework/wiki/RemoteLibrary

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

David

unread,
Mar 22, 2011, 6:27:27 PM3/22/11
to robotframework-users
Here's a good resource for building a Groovy remote server/library.

http://groovy.codehaus.org/XMLRPC

Look's much simpler than trying to do a pure Java remote server/
library, which I'm finalizing for release soon. Too bad I don't do
Groovy.

AndreasEK

unread,
Mar 23, 2011, 10:21:52 AM3/23/11
to robotframework-users
Hi Pekka,

On Mar 22, 11:12 pm, Pekka Klärck <p...@iki.fi> wrote:

> Do I get it right that the library you try to use is implemented with
> Groovy? If so, then this unfortunately isn't going to work directly as
> only Python and Java (requires Jython) can be used to write libraries
> natively.

I have not tried it myself, but compiled groovy is indistiguishable
from compiled Java source code. They both end up in regular *.class
files. So it should be perfectly possible to implement a library
directly in Groovy.

Andreas

Pekka Klärck

unread,
Mar 23, 2011, 11:05:15 AM3/23/11
to Andreas...@gmx.de, robotframework-users
2011/3/23 AndreasEK <Andreas...@gmx.de>:

Good point, thanks for a correction. To import such a library you
should then a) have the library in CLASSPATH and b) take it into use
like `Library | MyLibrary` or `Library | my.package.MyLibrary`. Could
someone with Groovy experience test this?

Reply all
Reply to author
Forward
0 new messages