Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Scout/Tutorial/3.7/Testing with Jubula

< Scout‎ | Tutorial‎ | 3.7
Revision as of 14:08, 14 December 2011 by Claudio.guglielmo.gmail.com (Talk | contribs) (New page: As we all know testing an application is essential. There are several approaches to make sure an application behaves as expected: Manual tests, programmed tests, recorded tests, etc. These...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

As we all know testing an application is essential. There are several approaches to make sure an application behaves as expected: Manual tests, programmed tests, recorded tests, etc. These tests are fine but also have a lot of drawbacks: Manual tests are very time consuming especially for regression tests. Programmed tests need to be written by a programmer and often don't view the software as a black box. Recorded tests can only test parts of an application which already work so a tester needs to wait until the development of the software has been finished before he can start creating the tests.

There is an eclipse project called Jubula which takes another approach. It let's you create automated tests before having the application ready without any programming effort. Additionally it lets you create readable, modular and reusable tests to ensure maintainability. The Jubula User Manual describes Jubula as follows:

"Jubula is a tool for the automated testing of Graphical User Interfaces (GUI's) written with Java (Swing, SWT/RCP, GEF) and HTML. The focus of the tool is on testing an application's business logic (workflows, use cases) from the user perspective (functional, black-box, acceptance testing)." (Jubula User Manual)

This sounds very interesting so we decided to check out how an application built with Eclipse Scout can be tested with Eclipse Jubula. And that's what this tutorial is all about.

Getting started with Jubula

Jubula comes as part of Eclipse 3.7 (Indigo) so you can in easily install it via update site. There is also a standalone version available from the Jubula website (http://www.eclipse.org/jubula).

Installation of Jubula via Update Site

In order to learn how Jubula works and how the tests are created I recommend the webinar of Alexandra Imrie: Functional Testing with Eclipse Jubula. Additionally have a look at the Eclipse Help of Jubula. There you can find a lot of information.

Create tests for a scout sample application

At this point you should know what Jubula is and even know how to write tests. If not, no problem. You do not have to write tests in this tutorial. Instead you will download an existing scout application and a little test suite to experiment with.

Download and export the sample application

First download the minicrm sample application from The Scout documentation has been moved to https://eclipsescout.github.io/. and import it into your workspace. In order to run the Jubula tests you need to export your test client. We'll try to get the tests running on the swt and swing client. So go to product files (minicrm-swt-client.product, minicrm-swing-client.product) and click the link "Eclipse Product export wizard". Choose a destination and click finish.

Hint: Jubula expects at least JRE 1.5 for Swing. After exporting the swing client there should be a "jre" folder beside the exe file. If not make sure the checkbox "Bundle JRE for this environment with the product" at your product file is checked. Otherwise it could be that Jubula can't connect to the application.

The swing client is now ready to be tested. For the swt (RCP) client, we need to add an additional plugin so that Jubula can connect. Go to your eclipse installation, copy the plugin called org.eclipse.jubula.rc.rcp_* and place it into the plugins folder of your exported swt client. Alternatively you could also add that plugin to the product configuration and export the client again.

Import the tests

After exporting the clients you need to switch to the Jubula perspective (Functional Test Specification perspective) and import the tests into the database. You can download an existing test suite here: Minicrm Tests

Import MinicrmTests_1.0.xml and ScoutModules_1.0.xml by selecting the menu entry "Test>Import...". The MinicrmTests project depends on the ScoutModules so you need both. The ScoutModules actually only contains some basic interactions with scout components like inserting text into a smartfield and is only separated due to modularity reasons. After importing the projects you need to open the project MinicrmTests by selecting "Test>Open...".

Importing the sample jubula projects
Opening the projects


Run the tests

Before running the tests you need to adjust the path to your exported application which you want to test. In Jubula such an application is referred as Application Under Test (AUT). Select the menu entry "Test>Properties", edit the AUT configuration and adjust the path so that it points to your swt client.

Adjust the path to your app

To run the tests you need to start the AUT agent by using the button "Connect to AUT Agent", in our case use the embedded agent. Then you need to start the AUT with the "Start AUT" button (don't forget to start your minicrm server before). Finally you can start the execution of your tests by clicking the button "Start Test Execution".

A messagebox will appear showing that you should add the RCP Remote Control Plugin to your application. Since we have already done that you can click proceed. After some more messageboxes the minicrm swt client will show up and after a few seconds the tests will start. Enjoy!

In order to run the Swing tests you need to import the File MinicrmSwingTests.xml and adjust the path to the Swing-AUT. That's it. This project depends on the MinicrmTests and reuses its test cases. Unfortunately the tests will fail because there seems to be a problem with the table component. See section "Experienced issues". If you know how to solve that please let me know.

Experienced issues

  • Working with tables is a little complicated and seems to be buggy. To select a row you need to select a specific cell. To do that you have to set the row which can either be an index or a value of the first column. You also have to set the column which can be an index or the name of a column. When I used a value for a column instead of an index it didn't worked for me with the swing client. When I use an index it works but not with the swt client when using 1 as index. Maybe there is an invisible column at the beginning, I'm not sure about that. Additionally using a value for the row (f.e. "Fred") works with the swing client but not with the swt client. Maybe I did something wrong, I don't know. So in this example to select a row column=2 and row=1 is used.
  • Jubula provides a functionality to move certain textcases to an external project. With this feature you are able to create a library project later and don't need to do it at the beginning, which is great. Unfortunately when I did this with the ScoutModules my MinicrmTests broke. The type of the logical components wasn't recognized anymore and I had to remove and create them again.
  • It seems that there are some issues with the language support. At first I chose German/Switzerland for my project. It took a while until I noticed the error in the problem view saying "Reused Project "unbound_modules_concrete" does not support language "Deutsch (Schweiz)". Either add language "Deutsch (Schweiz)" to "unbound_modules_concrete" or remove language "Deutsch (Schweiz)" from the current Project.". After changing the language settings to "German/Germany" the error went but my component assignments too. Argh.
  • When running the tests with the swing client the window opens and closes after every execution of a test step. I have no idea why. With the RCP/SWT client it works fine.

Conclusion

Jubula takes another approach in functional testing which is very interesting and works well for applications built with scout, at least for such basic tests. There are some custom components like the smartfield button and the smartfield list or the datepicker window which are not recognized by the Object Mapper. However, since you can enter the values directly, it works.

So please try and play around by yourself and let us know the results by using the Scout Forum.

Back to the top