Third-party library integration with Robot Framework’s jar

Personally, I arrived at my new company, and already got some new duties to fulfill. One of them was to get a GWT application under test. Since I made great experiences with Robot Framework and its Selenium Library while automating ParkCalc a while back, I decided to try it out for the application.

Besides all of the awkwardness coming form not generated ids on the xhtml of the web-pages, I finally got a first spike solution to run. After some more refactoring steps, I decided to provide some automation of the tests, so that my colleagues are able to work with it as well. Since the application is developed with eclipse in Java, I wanted to use a similar infrastructure to get the tests automated. Thereby, I decided to try out the packaged jar file of Robot Framework 2.5.x. This went amazingly smooth. Since I had to integrate the Selenium Library with the jar file, I was wondering, if this will be reusable, and what I need to do for it. The UserGuide describes, that I should repackage the jar, but this step I wanted to explicitly avoid.

Instead, I took a closer look. In order to try out the simplest thing that could possibly work, I created a lib directory in the eclipse that I had created, and added the jar file to that lib directory. Inside the lib directory I created a Lib directory (with upper case L), where I copied the SeleniumLibrary directory from my local installation, containing the python files necessary for the integration as well as the Selenium Server library in it’s own lib directory.

I was amazed that this was all I needed to do in order to integrate the Robot Framework jar file (which encapsulated jython) with the Selenium Library. I even tried to rename the installed Selenium Library just to be sure, that this was indeed all I needed to do, and was amazed when I found out that the packaged jython already created .class files for the Selenium Library python classes.

All I then needed to do, was to create an ant build script, which simply invokes the jarfile, and now I can call this from the build server of our continuous integration system. Wonderful, isn’t it?