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?

  • Print
  • Twitter
  • LinkedIn
  • Google Bookmarks

3 thoughts on “Third-party library integration with Robot Framework’s jar”

  1. Nice to see that the new JAR distribution is so useful. Were the instruction in the User Guide and in the JavaIntegration wiki page [1] good enough or would you like them to be enhanced somehow?

    Have you noticed there’s an issue about creating a separate SeleniumLibrary JAR distribution [2]? My original idea was to bundle the library and the Selenium Server, but including the SeleniumLibrary code in the Robot Framework JAR is an option too.

    [1] http://code.google.com/p/robotframework/wiki/JavaIntegration
    [2] http://code.google.com/p/robotframework-seleniumlibrary/issues/detail?id=132

    1. Hmmm, I could have packaged up the selenium library in a separate jarfile, as well. But instead I decided to put it into version control plainly.

      I found the description in the JavaIntegration a bit confusing. As I understood it, I was asked to extend the robotframework.jar with the addons and plugins, but I wanted to avoid to change the packaged jar file there. Now, I just put it unzipped there in the lib folder, so that the resulting structure is this:
      lib
      lib/Lib
      lib/Lib/SeleniumLibrary
      lib/Lib/SeleniumLibrary/__init__.py
      lib/Lib/SeleniumLibrary/assertion.py
      lib/Lib/SeleniumLibrary/button.py
      lib/Lib/SeleniumLibrary/click.py
      lib/Lib/SeleniumLibrary/element.py
      lib/Lib/SeleniumLibrary/javascript.py
      lib/Lib/SeleniumLibrary/lib
      lib/Lib/SeleniumLibrary/lib/selenium-server.jar
      lib/Lib/SeleniumLibrary/screenshot.py
      lib/Lib/SeleniumLibrary/select.py
      lib/Lib/SeleniumLibrary/selenium.py
      lib/Lib/SeleniumLibrary/table.py
      lib/Lib/SeleniumLibrary/xpath.py
      lib/robotframework.jar

  2. Hi markus,

    Such a great info, i couldn’t find a better site than this to explain extending robot framework jar file.
    My question may sound a bit immature but, could you please explain the line of your’s once again ” I created a lib directory in the eclipse that I had created, and added the jar file to that lib directory”.
    Did u mean, you created a lib directory inside the RF project folder or is it some where else. Your help is greatly appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *