Monday, March 28, 2011

Robot Framework at XP2011 Conference

Robot Framework has strong presence at XP2011 conference that is organized in Madrid 10th-13th May, 2011. Janne Härkönen and I, Pekka Klärck, will be present and we organize the following two sessions.

Demo: Acceptance Testing with Robot Framework
This is a short introduction targeted mainly for people without earlier experience about the tool. The session is organized on Wednesday 11th May and more information can be found from the conference pages.
 
Tutorial: Acceptance Test Driven Development (ATDD) with Robot Framework
In this four hour tutorial we concentrate on the ATDD process, but participants also learn how to create ATDD tests with Robot Framework. The tutorial is organized on Friday 13th May and the contents are explained in more detail on the conference pages.

We are also highly interested to discuss any Robot related topics with the users of the framework and anyone who is interested. If you are coming and want to chat let us know beforehand or just find as wondering around the conference area. If there's more interest, perhaps we can organize an ad-hoc Robot session around a jar of sangria.

Using Jython REPL to explore with SwingLibrary

Today, I was faced with creating an extension keyword to SwingLibrary, and I wanted (of course) to also make a Robot test case testing that new keyword. With non-trivial applications, Swing tests always require quite a bit of setup, many keywords have to be used before the interesting component is available.

Using Robot Framework to get the setup "right" is quite slow, since the turnaround time (= time to execute the test) is quite long, at least some tens of seconds. There is a somewhat faster method of using the SwingLibrary directly from an interactive Jython session. So I fired up Jython with the dependencies in the CLASSPATH:

CLASSPATH=bin:lib/swinglibrary-1.1.3-jar-with-dependencies.jar jython

And did some exploration:

import SwingLibrary
lib = SwingLibrary()
lib.runKeyword('startApplication', ['com.acme.MyFancyApp'])
lib.runKeyword('selectWindow', ['myMainWindow']) 
lib.runKeyword('listComponentsInContext', [])
...


There are a couple things worth noting here:
  1. It is easiest to use the SwingLibrary keywords using the runKeyword-method, since the actual keywords are not methods of the SwingLibrary class.
  2.  When using runKeyword, the arguments are always given in a list and the list has to supplied, even when it is empty.

When the desired workflow is achieved the keywords can be written down in a test case.