Sunday, March 4, 2012

Jubula- The UI tester for Eclipse

As you can guess, this is going to be a quite boring post, which is intended for a narrower audience than usual.
Bear with me.
Disclaimer: This post is a collaborative effort by me, Supun, Janindu, Rashmi, Madhushi, Akila, Samiththa, Meuru, Nilaksha and Kevin.

What is UI testing?UI testing stands for user interface testing. Tester will test how the application will be interfaced to the users. These testing will include scenarios such as testing whether the windows are easily understandable by the users, colours of the interfaces are appropriate and matching, the font is readable, and whether the menus and buttons are working properly etc.

Why use Jubula for UI testing?
Jubula is a tool provided by the eclipse foundation to test 

  • eclipse rich client platform (RCP)
  • standard widget tool kit (SWT)
  • swing applications
  • web applications etc.
Though there are many commercial tools for testing RCP/Swing/Web and SWT applications, when it comes to free tools for testing them "Jubula" is a good choice for consideration.


What is Jubula?
We know how laborious writing test cases is. Despite that it's meant to make our lives easier for catching 'bugs' at an early stage of life(of the bug), it often is the case that the writing of the test codes is even more complicated given that you have to be pretty hefty in defining dependencies, building repositories and so on.
Jubula is a tool meant to automate this procedure (at least to an extent). It runs on the Eclipse environment and basically supports the testing of eclipse products. Let us see how this is done.

Installation of Jubula
Before using Jubula, we have to install it. The following text describes the installation process.
Since Jubula is java based, it should run independent of the underlying hardware. Still, developers have defined minimum and recommended hardware requirements as follows.

Minimum Hardware Requirements

  • 1 GHz processor
  • 512 MB RAM
  • 350MB Hard drive space
  • 300MB temporary space during installation 
Recommended Hardware Requirements
  • 2 GHz processor
  • 1GB RAM
Operating Systems
  1. Microsoft Windows (XP,Vista,7)
  2. Linux
  3. Mac OS (except SWT AUT's)
Jubula supports Oracle 9-10 multi-user database
Obviously you have to have a Java environment installed in your computer. Jubula supports from Java 1.5 upwards. Java 1.6 is provided in the installation package. The latest version Java 7.
Installable Packages : Jubula has 2 components.
  1. Integrated Test Environment (ITE)
  2. AUT agent
The available installable packages are :
  • Jubula (Includes ITE and test execution)
  • AUT agent
  • Jubula documentation
Reference: Jubula Installation Manual


Special features of Jubula Installation
  • Ø You do not need administrative privileges to install Jubula.
  • Ø All you needed is a folder where the software will be installed must be writable and allow program execution
  • Ø Jubula uses a graphical installer to make the installation easy and pretty straight forward.
  • Ø Jubula installation can be done not only on PCs , but this installation can be done on servers as well. This is referred as installing Jubula centrally.

Why Jubula centrally installation is important?
  • Ø Most of the time the developers create the tests locally on their PCs.
  • Ø When the process is moved to the quality assurance step tests should be moved from the working (local) database to the development (QA) database.
  • Ø At this time having Jubula installed on a server will be useful.
  • Ø At the time of parallel testing on different flat forms, at each parallel test one Jubula installation is required. But any specific server systems testing need not to be performed.



Let's go through the installation process, (which is pretty straight forward ) . All you have to do is go to http://www.eclipse.org/jubula/download.php and choose the relevant standalone version for your desired operating system. And the installation is as simple as anything but make sure that at the time of installation, you tick all three check boxes that have Jubula , AUT Agent, and Documentation. 

Initial configuration for testing and AUT setup. 

Before we start using Jubula, there are some things we need to take care about. For an example, let's use a RCP application to demonstrate. First startup your eclipse workstation and create a new plugin-project. And 

OK, now you should know the drill, give a decent name to the project and if you want you can give a specific location that you want it to be. Now, Click 'Next' and select RCP Mail Template. (let's create a new mail application for fun ). Also, make sure you have this to be a 'rich client project'

                           



And now your application is created by clicking 'Finish'.
Before we use Jubula on our application, we need to export it as a product. Here, there is a bit of a streaky job due to a built in bug in eclipse in exports. First of all, right click on your project, click export. When exporting, please make sure to export it as an 'Eclipse Product'.

And the first time you export it, make sure you do NOT generate the meta data libraries. How ever, once the export is done, redo it and this time, with the 'generate metadata libraries' check box deselected. This way, you should end up with an Eclipse product, with an executable file.

Before we go on with the testing, there is a couple of things to take care of. Go to your Jubula installation directory, and you'll find a zip with name 'rcp-support'. You'll find a folder starting as 'org.eclipse.rcp....' in it. Copy it into the 'plugin' directory of your product and find the configuration/config.ini file in the product folder. There will be a line with the ''osgi.bundles'' reference, and to the end of that, add the folder name (with the version number) to the end of that line.

once this is done, you're ready to go.

Now, one more thing. Run the 'Start AUT agent' application( you may need administrative privileges).

Now, once you have installed Jubula, start it.

Go to 'Test->new ' and new project. And you have to follow some steps to make sure that your application under test is well linked to your test interface.

The Jubula new Project wizard should appear, you should see an interface like this. Give a suitable name to your project.
     


Once this is done, You have to select an AUT agent and start the connection. (for more information about linking in Jubula, follow this link ). 

Once you've done these, you have a go at the testing. Now click on the 'Observation mode' (camera icon) and select your project and give a suitable name for the testing. Now you will see an observation window appear. 


Now, clicking on buttons of your application should give you an 'observation' in the console. 




So you can see how far this testing can go right? :D 

Follow the following link for a more detailed approach. 

Yeah, this link... :) 

And now, fore more serious stuff. 

Database Configuration in JUBULA

Jubula is somewhat special in database handling, as it create database automatically.So Make sure to use a clean database. Which make sure that is would not contain any table.
You can use following configuration methods to have the optimum use of Jubula.
· Using the embedded database with Jubula
If you don’t specify a database the default DB will automatically selected. It is called as embedded database and its a H2 file-based database. And save to home/.jubula/database
· Using an Oracle database with Jubula
It is recommended to use Oracal or Oracal Express Database with jubula.
· Using a MySQL database with Jubula
It is important to change the packet size, as it may cause to make problems in comunicaton packets which are larger than 1MB.
You can follow following steps to change the packet size.
Step 1: Log into the MySQL command line client.
Step 2: Enter the following into the console:
SET GLOBAL max_allowed_packet=33554432
<<This sets a value of 32 MegaBytes? (1048576 * 32 = 33554432)>>
Step 3: Check that the value has been successfully set using:
SHOW VARIABLES
Step 4: Restart Jubula for the changes to take place.



Comparison to other testing approaches
Testing is a main task of software development process and it is critical to the success of software project. It is important to acceptance test software which is designed for end users.
There are various ways to perform acceptance tests. Some of them are
1) Manual tests
2) Programmed tests
3) Recorded Tests
But jubula approach is more effective than other testing approaches as Jubula makes lets you automate tests which follow the best practices ( readability, modularity and reusability to ensure maintainability) known from software development , but without any programming effort.
Some advantages of jubula approaches are as follows.
1) Early test creation
Jubula tests are created before the AUT is available. This is a radical advantage over capture-replay tools, which force testers to wait until an application is ready to begin with testing. The specification of modular, flexible GUI tests begins early and continues alongside software development.
The benefit of this is that every version of an AUT can be tested as soon as it becomes available. Testing keeps up with development, so we don’t waste time in our test process. It is easier and cheaper to fix and encourage collaboration when find issues earlier by testing
2) Code –free automation
Tests are automated completely from the user perspective and require no programming effort. This means that those who understand the user perspective best are able to fully automate tests. There is no need to wait for input from other team members to automate a test. If developers are writing tests, the black box perspective encourages them to think like a user would when faced with the software. Code-free tests also have the advantage that they are readable by the whole team and also by users or customers.
3) Manual tester intelligence
The wide range of keywords available in Jubula include high-level actions.So testers can use them meaningfully to do their testings. There is also a wide range of check and synchronization actions to incorporate the necessary robustness into a test.