A Step-by-Step Guide to Jubula – The Open Source Automated Functional Testing Tool

[Detailed tutorial with lots of images, so allow it to load]

Today, we are going to learn a popular open source functional testing tool – Jubula.

It is an Eclipse Project for automated functional GUI testing for many applications. It’s is helpful for writing automated tests from the user perspective with little or no coding skills, saving time and improving readability and test maintenance. 

A wide range of open source automation tools are available in the market with the good amount of online help. 

When it comes to Jubula, the online help provides a lot of information on its built-in framework. This information is of great use to those non-technical testers who are not involved in coding and want to create automation scripts through Jubula’s GUI.

But the technical automation testers wanting to create a customized framework using Jubula find it difficult to reach out the help. 

This detailed tutorial is created with an aim to share the knowledge I have gained in Jubula to help you create a customized, robust and flexible automation testing framework.

jubula-tutorial

Let us first look into it’ss built-in framework (This section of the tutorial will help you to understand the basics) and then proceed with Building framework in Jubula using Java code.

The Basics – built-in framework:

Installation and Launch:

(Note: click on any image for enlarged view)

1) Go to the download page here.
Note – You can check this download page for various options based on the features you are interested in.
2) Register and Login.
3) Click on Download Installers.
4) Click on the download page under Jubula downloads section.
5) Download the appropriate installer (as per the OS).
6) Install it using the downloaded exe file and save the folder in a preferred location ( I have saved it in C:\Program Files).
7) Once the installation is completed, you should be able to launch the tool from ‘All programs’.

42

8) While launching create the workspace in a preferred location.

45

9) Home screen will look like below:

2

Sample AUTs:

One impressive thing about this tool is that it comes with sample AUTs (Applications Under Test). The AUTs will be present in <Installation Folder>\examples\AUTs.

In this case, it is found in C:\Program Files\jubula_8.2.0.021\examples\AUTs

3

Demo Project

Now with Jubula installed and sample AUTs available, let us try to automate a simple addition functionality using a ‘swing’ application called ‘SimpleAdder’.

This application can be invoked using the file:

‘C: \ProgramFiles\jubula_8.2.0.021\examples\AUTs\SimpleAdder\swing\SimpleAdder.cmd’ and looks like below:

The task is to enter ‘value1’, enter ‘value2’, click ‘=’ button and verify the ‘result’.

44

How to Test:

Below are the steps to be followed to automate the task:

Step 1 – Create project.
Step 2 – Create AUT.
Step 3 – Create test case, include test steps & map data.
Step 4 – Create test suite.
Step 5 – Assign AUT to the test suite.
Step 6 – Map the test case to the test suite.
Step 7 – Map logical test objects with technical object identifiers.
Step 8 – Run the test suite.

Let us see how to perform each step in detail:

Step #1 – Create project

A Project in Jubula can be considered as a logical workspace where all required components are gathered to complete a testing task.

Creation of a project goes as below:

1) Go to Test > New.

4

2) Enter the name of the project, E.g. ‘DemoProject’ and Click ‘Finish’ (On clicking ‘Next’ you should be able to create AUT. But let us ‘Finish’ here and look at creating AUT in Step #2).

5

3) The Test Suite browser shows the created project.
6

Step #2 – Create AUT

An instance of the application under test (SimpleAdder) has to be created in Jubula for object mapping and to run the test suite.

1) Go to Test > Properties.

7

2) Choose ‘AUTs’.

8

3) Enter the AUT name (this can be any user defined value. E.g. DemoAUTSimpleAdder).
4) Choose the technology the AUT is developed on. (In this case, it is ‘swing’).
5) Click ‘Add’ under AUT configuration.
6) Enter AUT ID (this can again be any user defined value. E.g. DemoAUTSimpleAdderID).
7) Enter the executable file name i.e. the file invoking which the AUT will be opened. As mentioned earlier I have used ‘C: \ProgramFiles\jubula_8.2.0.021\examples\AUTs\SimpleAdder\swing\SimpleAdder.cmd’ .

9

Please note that in order to invoke the AUT through Jubula, it must have been connected to ‘AUT agents’, There are two AUT agents Jubula can connect with:

  • Embedded AUT agent installed at ‘localhost:60001’
  • External AUT agent installed at ‘localhost:60000’

Once Jubula is connected to either of the AUT agents, you should be able to invoke the application through it. The below screen shot shows how to connect to AUT agents. Here I am connecting to the embedded AUT agent.

The below screen shot shows how to connect to AUT agents. Here I am connecting to the embedded AUT agent.

10

Once AUT agent is connected with Jubula, the AUT (DemoAUTSimpleAdder) can be invoked as below:

11

The AUT will be invoked as below. The application can be kept running in the background. But, at this stage, I prefer to close the application to be comfortable in performing the rest of the steps.

44

Step #3 – Create test case, include test steps and map data

This is the crucial step where actual development of automation scripts happens (without coding).

There is a Test case browser at the bottom left part of the tool where user test cases can be developed.

1) Right click and move to New to create a new test case.

12

2) Enter the test case name and click ‘OK’ (E.g. DemoTestCase).

13

3) The test case browser now should have the user created test case along with Jubula’s built in test cases.
4) Double click on the created test case. The empty test case will be opened in the middle panel.

14

5) Drag and drop the appropriate test actions from ‘Jubula’s base actions’ into the test case.

As shown in the below screenshots:

  • To enter value1 and value2 use ‘Component with Text input – replace text’.
  • To click equals button use ‘Click left single’.
  • To check the value use ‘Component with Text input – check text’.

15

16

17

6) Now for each test step included enter the below as applicable (E.g. Clicking a button does not need any data):

  • Test case reference name (Test step description).
  • Component name (Logical name to which technical identifier will be mapped).
  • Data – Data can be entered as direct value e.g. 10, 20 or parameterized using variables e.g. =Value1, =Value2 or fed through an excel sheet. In this case, I am parameterizing the data).

a)

18

b)

19

c)

20

d)

21

7) As mentioned in the previous step, when data values are parameterized, highlight the test case as below. You should be able to see a grid where the values for variables can be defined. Use ‘Add’ button to insert a row of data. You can have n number of rows of data for n number of execution iterations.

a)

22

b)

23

Step #4 – Create test suite

A Jubula’s test suite is a runnable component under the project where user defined test cases are sequenced for execution.

------------

1) Right click on the project and move to New to create a new test suite.

24

2) Enter the name of the test suite and click OK (E.g. DemoTestSuite).

25

3) You should be able to see the created test suite under the project.

26

Step #5 – Assign AUT to the Test Suite

When there is just a single AUT defined in Jubula, the AUT will be automatically selected for the test suite. But when there are multiple AUTs, it is very important to make sure that the test suite runs on the correct AUT.

1) Double click on the test suite and highlight the same in the middle panel.
2) Select the AUT from the drop down.

27

Step #6 – Map the test case to the test Suite

Drag and drop the test case to the test suite. Multiple test cases can be sequenced under the test suite likewise.

28

On saving, you should be able to see the test case under the test suite as below:

29

Step #7 – Map logical test objects with technical object identifiers

1) Right click on the test suite and open with object mapping editor.

30

2) All the logical components within the test suite for which technical names are to be mapped will be displayed.

31

3) Invoke the AUT.

32

33

4) Click on the object mapping icon for the particular AUT.

34

5) Move the cursor over the field for which you have to identify the technical name. The field will be highlighted in green.

35

6) Press control + shift + Q to have the corresponding field’s technical name under the unassigned technical names section. Repeat for all the fields in the test suite.

36

7) Now map unassigned component names with an unassigned technical name by simple drag and drop.

37

8) Save the workspace and quit from the object mapping mode.

38

Step #8 – Run the test suite

Now the test suite is ready to be run. Make sure the AUT is invoked using Jubula.

Click on the run button in the test suite browser.

(You can also activate the application as the first step. But when you don’t have it ensure that you activate the application after running the test suite).

39

Results can be viewed as below:

40

Points to be noted

While feeding the test suite with data through Excel, provide the location of the excel file in the example format:

C://Data//Data.xls

41

In the above demonstration, the data is parameterized using the variables ‘=Value1’, =’Value2’ and =’Result’.

In such case when the values need to be passed through an excel file make sure that the file has the corresponding columns with names exactly matching the variables and sheet name set to the language chosen at the time of project creation.

46

External AUT agent (localhost: 60000) can be connected after starting the agent from ‘All programs’ where you can find options for starting and stopping the agent.

42

Multiple test suites can be created under a test job. This would be of help when the testing involves more than one application (Different AUTs can be assigned to different test suites).

This explains the basics to play around the tool. It is very important to get familiarized with Jubula’s basic actions to automate complex functionalities and deal with various test objects.

Jubula can also automate applications developed with different technologies, not just swing application.

43

Building framework in Jubula using Java code:

With the above basic knowledge let us now see how to build a customized framework in Jubula using Java code.

Some may not find automation in Jubula workspace flexible and reusable. Extensive automation may not be possible. But for each action we have done using Jubula GUI, there is a corresponding java method.

Here in this section, we will see the basics of such java methods with which any complicated framework can be built.

Jars

The jars required for the methods are available in Jubula’s installation folder:

C:\Program Files\jubula_8.2.0.021\development\api

47

AUT

Let us first see how to connect with the AUT agent and how to invoke the AUT by creating AUT identifier using AUT configuration

We need the below variables:

AUTAgent autagent = null;
AUTConfiguration autconfiguration = null;
AUTIdentifier autidentifier = null;
AUT aut = null;

Connecting with AUT agent:

autagent = MakeR.createAUTAgent("localhost",60000);
autagent.connect();

Launching AUT:

autconfiguration = new 
SwingAUTConfiguration("Autidentifier", "Autidentifier","runlocal.bat", "C:\\Application",null,Locale.getDefault());
autidentifier = autagent.startAUT(autconfiguration);
aut = autagent.getAUT(autidentifier, SwingComponents.getToolkitInformation());
aut.connect(); 

Where runlocal.bat is the executable and C:\\Application is the location where an executable file is present.

We can create the configuration for other tool kits too.

For e.g. JavaFXAUTConfiguration, RCPAUTConfiguration, HTMLAUTConfiguration.

The test actions can now be performed using the instance ‘aut’. But we need to have the object identifiers to perform test actions.

Creating Object Mapping Class

Right click on the object mapping editor, choose ‘Export Object Mapping to File’ from ‘Use in API’ option and export the object mapping details to a Java class.

48

Include this class in the project. I have saved it as OM.java where technical identification of each object in the object mapping editor is present.

49

Performing Test Actions

Test actions can be performed in two steps:

Step 1: Define the component on which test action has to be performed.

TextInputComponent input1 = SwingComponents.createJTextComponent(OM.txtValue1);
TextInputComponent input2 = SwingComponents.createJTextComponent(OM.txtValue2);
ButtonComponent equals = SwingComponents.createAbstractButton(OM.btnEquals);
TextComponent result = SwingComponents.createJLabel(OM.txtResult);

Step 2: Perform the action.

aut.execute(input1.replaceText(“10”), "jubula");
aut.execute(input2.replaceText(“15”), "jubula");
aut.execute(equals.click(1,InteractionMode.primary), "jubula");
aut.execute(result.checkText(“25",Operator.equals), "jubula");

Where “Jubula” is just a dummy text which preferably should carry the description of the action.

The ‘execute’ statement carries CAP (C – Component, A-Action, P-Parameter (Data)).

Action and Parameter correspond to the same of Test cases in Jubula workspace.

Working with multiple AUTs

Working with multiple applications and swapping between them is a bit tricky when you develop your own framework using Jubula java methods.

While dealing with multiple applications, make sure the AUT is activated before performing actions and the same is deactivated once you are done.

While activating:

  • Connect autagent.
  • Connect aut.

While deactivating:

  • Disconnect aut.
  • Disconnect autagent.

e.g

Activate(autidentifier1);
//perform actions on aut1
Currentaut.execute(…)
Currentaut.execute(…)
Deactivate(autidentifier1);
Activate(autidentifier2);
//perform actions on aut2
Currentaut.execute(…)
Currentaut.execute(…)
Deactivate(autidentifier2);
Activate(autidentifier1);
//perform actions on aut1
Currentaut.execute(…)
Currentaut.execute(…)
Deactivate(autidentifier1);

Activate and Deactivate functions should be something like this:

public static void Activate(AUTIdentifier autidentifier){

if(autagent.isConnected())	{
	autagent.disconnect();
	autagent.connect();
}			
else
	autagent.connect();	

if(Currentaut==null){
	Currentaut = autagent.getAUT(autidentifier, SwingComponents.getToolkitInformation());	
    Currentaut.connect();
}

else{

	if(Currentaut.isConnected()){
		Currentaut.disconnect();
		Currentaut = autagent.getAUT(autidentifier, SwingComponents.getToolkitInformation());	
		Currentaut.connect();
	}
	else{
		Currentaut = autagent.getAUT(autidentifier, SwingComponents.getToolkitInformation());	
		Currentaut.connect();
	}
}

}

public static void DeActivate(AUTIdentifier autidentifier){

if(Currentaut.isConnected())
	Currentaut.disconnect();

if(autagent.isConnected())	
	autagent.disconnect();

}

Conclusion

At the end of this article, one must have acquired good knowledge in using the existing framework of Jubula and developing a custom framework using Jubula’s java methods.

Here, we have studied automating Java swing components. However, Jubula can work on multiple technologies.

Automating multiple applications (of the same and of the different technologies) at the same time is the most challenging area. The steps detailed in Working with multiple AUTs should really help.

While thinking of building a custom framework using Jubula, you must be wondering how to define different test components (e.g button, textinput, text, tree, table,etc) , what are all the different actions that can be performed on these components and what data are required for each action.

In order to know how to define different components and how to perform various test actions using ‘execute’ command, please refer ‘Jubula Reference Manual’ here.

Give it a try!

About the author: This is a guest tutorial by Geethalakshmi. She is working as a principal technical engineer in a leading software testing organization with a great interest in exploring functional automation tools.

Feel free to post your comments/queries about Jubula tool.

Recommended reading

14 comments ↓

#1 abinaya

i really thank yo you.. it was so nice to learn..can you please send a pdf file of tutorial.. it will help me in future.

#2 SANMATI PATIL

Hello, I have done engineering in Computer Science, i am looking for work from home job opportunity related to software testing. I have work experience in soft development. Where can i get software testing work related information? Pls share any details about this.

Thanks In Advance
Sanmati

#3 kiran

its Really knowladgeable article for tester. And all concept showes in detail so nice. keep do post .

#4 Snehal

Thanks a lot for tutorial, I think it will be good to combine selenium with jubula to automate beyond browser

#5 Khaulah

Hi
I’m getting the below error upon Invoke “3) Invoke the AUT” step

5009: AUT start failed
No valid Java binary found. Check given JRE binary.

#6 Khaulah

Hi
I’m getting the below error upon Invoke “3) Invoke the AUT” step, so please help in solve it.

5009: AUT start failed
No valid Java binary found. Check given JRE binary.

#7 AARav

Can we use it for JAVA/.Net based web apps . As it is mentioned that it supports HTML apps.

#8 Geetha

Apologies for late reply. Can you pls elaborate what you actually do to face the error, may be in a word doc and send to my mail geethalucky15@gmail

#9 kiran

Hi
I’m getting the below error upon Invoke “ Invoke the AUT” step, so please help in solve it.

5009: AUT start failed
No valid Java binary found. Check given JRE binary.

#10 Geetha

Abinaya, Kiran and Snehal,
Thank you so much for your encouraging words :)

#11 Geetha

Aarav, yeah it supports html

#12 Geetha

Khaulah and Kiran,

Did you manage to solve the error?
Please check if you had chosen appropriate tool kit while adding the AUT.

Try using cmd instead of jar file. BTW what version of java you guys use?

#13 Jasper

Thank you for this detailed and nice Tutorial!

#14 Murilo

That’s a really good tutorial, thank you! Is it possible to write my AUT using JUBULA API and somehow export it again to use with Jubula/Eclipse?

Leave a Comment