UI Testing with Eclipse Jubula: Preparing the Test Object (1)

Recently, Bredex created an interesting product at the Eclipse Foundation: namely, Jubula, a tool for UI testing Eclipse RCP, SWT, Swing and web applications. Basically, I guess this will become the “community edition” of GUIDancer, which is good enough for me, considering the dire need for any free UI testing tool for RCP, SWT or Swing at all.

I won’t go into comparisons with other tools in this post, but in short, imho, though there may be better tools for web testing, though there may be alternatives for Swing testing, though there may be better commercial tools for testing RCP and SWT, when you’re looking for free tools for testing RCP/SWT, I think you should start with Jubula.

Unfortunately, working with Jubula turns out to be a bit unwieldy at first. – So I’ll try to give a detailed step-by-step guide to your first GUI test automation with Jubula here, using a simple Eclipse RCP sample project as the test object.

So, let’s start with setting up the test object first: Open up Eclipse and create a new plug-in project (File/New/Project…/Plug-in Development/Plug-in Project):New Plug-in Project Wizard, Page 1

Next, tell Eclipse that it’s a rich client application:New Plug-in Project Wizard, Page 2

And finally, choose the “RCP Mail” template:New Plug-in Project Wizard, Page 3

Now, let’s see what we’ve got in our workspace:The Mail RCP project, with warnings!

Hey, wait, what’s that, warnings about raw types? – We can’t tolerate that. I’ll quickly fix these by turning the List into a List<TreeObject>:Fixing the warnings

That was easy. Actually, why do they have these warnings in their sample code at all? – Anyway, what’s next? Right, let’s try if it works:Ok, it runs

Looking good. This should be simple enough for our first steps, yet complex enough to play around a bit. – However, for exporting the application, we’re missing a product configuration (File/New/Product Configuration):Creating a product configuration

Alright, now we’re set for exporting the RCP application as Eclipse product (File/Export…/Eclipse product):Exporting the RCP product

Finally, we’re done with preparing our test object. Or are we?

Actually, we’re not, unfortunately. The reason for this is that sadly, the Eclipse JFace/SWT libraries haven’t got any easy way to access/instrument them for automation on the fly (unlike Swing).

So, Jubula has to somehow hook itself into our RCP application, and we have to help with that: Look for the archive rcp-support.zip in your Jubula installation directory and extract it into your product directory. This will add a Jubula instrumentation plugin to your product.

However, that’s not all. You’ve still got to activate that plugin, and you can do that by editing the configuration/config.ini file in your product directory. There’s a long line in that file listing the osgi.bundles, and you have to add the Jubula plugin at the end:Configuring the OSGi bundles

Phew. Now we’re really really done with preparing the test object. Of course, for real projects, you’ll probably want to automate all these preparations in your build.

Let’s start up Jubula and do some testing! – Or wait, actually, let’s do that in my next blog post. :)

Posted in Eclipse, Java, Testing by jmhofer at May 13th, 2011.
Tags: , , , , ,

19 Responses to “UI Testing with Eclipse Jubula: Preparing the Test Object (1)”

  1. Dennis Doubleday says:

    WindowTester is now free, too. It is an excellent tool, IMO. The former Instantiations product (now owned by Google) can be downloaded from http://code.google.com/javadevtools/download-wintester.html

    • jmhofer says:

      Indeed. I know about WindowTester (however, it’s only “free as in beer”, if I’m not mistaken), and there’s always SWTBot, too. – I’m half planning to post the same kind of tutorial, exercising those two alternatives, too.

  2. […] UI Testing with Eclipse Jubula: Preparing the Test Object (1) – jmhofer’s insignificant … […]

  3. […] Jubula comes with quite a good User Manual. For an introduction on how to create your first Jubula test, I’d recommend the excellent series of posts by jmhofer. […]

  4. […] follow up to Joachim Hofer’s series and Matt’s post on Jenkins and Jubula, I thought I’d write a short […]

  5. Veit Hoffmann says:

    Hi, great Intro…

    if you got a p2 conformant RCP the jubula rcp plugin should be installed via p2 update site. I created such a site if you want to test it you can access the it here:
    http://dev.viper.sc/viper.updatesite/thirdparty/indigo/jubula/
    I didn’t categorize the site, therefore you have to uncheck group items by category.

    Cheers,

    Veit

  6. Maarten says:

    Thanks for your article!

    I have a question. You state “imho, though there may be better tools for web testing”. Although you don’t want to get into comparisons, I wonder what tools you would suggest. Selenium seems to be the most widely used, but I miss parameterized test cases and reuse of test cases in other tests. Do you know of a functional web testing tool that provides these kind of things?

    Thanks,
    Maarten

  7. […] can start your testing exercises. All the post-installation steps are pretty well described in the UI Testing with Eclipse Jubula: Preparing the Test Object article, so you may dig for details there, I just want to focus on differences with Q7. Jubula […]

  8. […] a start, I’ll stick to a nice blog http://jmhofer.johoop.de/?p=97 I found. Also, the CI setup seems well explained […]

  9. Samantha Guillot says:

    Hello,
    I am trying to follow your instructions for Jubula but I am getting stuck. I have Eclipse 3.7.1 with Subclipse and Jubula plugin installed.

    I am trying to create the plugin project and have gotten to the dialog where I have to choose yes “Would you like to create a rich client application?”

    When I click on the Yes radio button, it greys out the “Next” and “Finish” button. Do I need another plugin? I can’t continue on with your tutorial.

    • Samantha Guillot says:

      Is it insufficient to download the plugin? Do I have to do the standalone download to get everything to work?

      • Martin Goebel says:

        You have to install the “Eclipse Plug-in Development Environment” and “Eclipse RCP Plug-in Developer Resources” plugins from the Eclipse update site.

  10. Eugene says:

    Hello,

    Is it possible to update these steps? I am using Juno (RCP and RAP) Build id: 20120614-1722 and I already have an RCP4.2 Application. I want to use that instead of the mail template. What do I do?

    The other thing is this rcp-support.zip. I can’t find it anywhere.

    Thanks

    • Devin says:

      Eugene,
      rcp-support.zip can be found under the Jubula installation directory, and then the development folder.

      For me, this was jubula_7.1.00054 > Development > rcp-support.zip

      • Erick Hagstrom says:

        Those of us who are using Jubula as an Eclipse Plug-in don’t have a Jubula installation directory. I’m still working out what to do for that environment, but I’m pretty sure it includes adding org.eclipse.jubula.rc.rcp to the Dependencies tab in the .product file.

  11. Bernard Rossi says:

    Hi,
    I’m trying to implement Jubula 7.2 with some RCP 4 projects using kepler eclipse. A few questions about your excellent article “UI Testing with Eclipse Jubula: Preparing the Test Object (1)”

    1. “Look for the archive rcp-support.zip in your Jubula installation directory and extract it into your product directory. This will add a Jubula instrumentation plugin to your product.”

    What “product” directory is that? eclipse/plugins or runtime-,projectname>.product or something else? I found the rcp-support.zip file.

    2.”You’ve still got to activate that plugin, and you can do that by editing the configuration/config.ini file in your product directory. There’s a long line in that file listing the osgi.bundles, and you have to add the Jubula plugin at the end:”

    I don’t see a config.ini file under the target directory. Do you know if that information is somewhere else?

    Thank you,
    Bernard

  12. Bernard Rossi says:

    Here is a clarification that resolves the problem.

    After you export the product,
    1. Go to the directory where the project was exported to.
    2. Edit the config.ini file in the Configuration subdirectory.
    3. Add “,org.eclipse.jubula.rc.rcp@start” to the end of “osgi.bundles=”
    4. Extract the org.eclipse.jubula.rc.rcp_nnn.jar file from rcp-support.zip to the plugins subdirectory of the exported product.

    Bernard Rossi

  13. Sachin Daniel Varkey says:

    I used embedded DB,but when i tried to open a new project it is telling,Db connection failed ,Please enter a valid usrname and password.But i tried like reebooting the system,firewall settings change.Nothing works for me

  14. Payam says:

    Would this work on RCP app with embedded Swing editor (SWT_AWT bridge)

Leave a Reply