Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Jubula » Writing jubula tests in java(Help to write jubula tests in java)
Writing jubula tests in java [message #1705009] Tue, 11 August 2015 11:55 Go to next message
geetha nirmal is currently offline geetha nirmalFriend
Messages: 3
Registered: July 2015
Junior Member
Hi, Can anybody please help on the below four queries on writing jubula tests in java

Query1: How to activate application using java code
I use the below code to start the AUT SimpleAdder.
AUTConfiguration autconfiguration = new SwingAUTConfiguration("api.aut.conf.simple.adder.swing",
"C:\\Program Files\\jubula_8.1.00294\\examples\\AUTs\\SimpleAdder\\swing",

AUTIdentifier autidentifier = autagent.startAUT(autconfiguration);

Now I want to activate it. I understand that I can achieve it something like this
Application App = SwingComponents.createApplication();

I have two questions here

Question1- as per the CAP, activationmethod is of datatype 'String'
But java want it to be of type 'AUTActivationMethod'. This shows error when I am writing code in java

Question2 While writing jubula tests in ITE when more than one AUT is involved, all the AUTs involved needs to be kept open and maximized and activate method will make the required AUT active. But while writing java code,the application cannot be kept open. Instead it will be opened using the code mentioned above which make me to manually maximize the application. Also this will create problem when I open another AUT during run time and try to activate it (because the second AUT would be minimized after it is opened during the code)

Query2: How to store value from a text box
Store keywords cannot be written using java code. It is mentioned that this can be achieved using java functions. But how ?
TextInputComponent input1 = SwingComponents.createJTextComponent(OM.ObjInputValue1);
input1.<here I should be having a function to retrieve and store its text which is not available>

Query3: convert jubula project to API for use in java is not working

When I try convert jubula project to Java for use in API .

I get the below error. "Probably no permission to write file" I checked with other PCs and with admin access too.

Query4: Writing results
Aut.execute(CAP cap, T payload)

What is this payload , what should go here.
Also, it is mentioned this would return the result , but when I print it i.e when I write System.out.println(Aut.execute(CAP cap, T payload)) I get something like

org.eclipse.jubula.client.internal.impl.ResultImpl@170526a. It is not giving me either pass or fail.
Also when a step fails I get the below exception. Is this because I am not capturing the result?. How to capture the result out of the execute statement.

Exception in thread "main" org.eclipse.jubula.client.exceptions.CheckFailedException
at org.eclipse.jubula.client.internal.impl.AUTImpl.processResponse(
at org.eclipse.jubula.client.internal.impl.AUTImpl.execute(
at Jubula.main(

Please help

Re: Writing jubula tests in java [message #1705101 is a reply to message #1705009] Wed, 12 August 2015 07:15 Go to previous message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Hello Geetha,

Thanks for your questions.

Question 1

The "activate application" method does not actually call the application to the front. It simply clicks in the application to ensure that it has the focus. If something else is in front of the application, this action will fail. When working with multiple applications, you should be able to write the test in such a way that each application is left running, if that is what you need. The code above only configures the AUT. The method startAUT() starts it, and the method connect() actually connects to it. (You can see this in the blog entry and also in the examples referenced here). You can have multiple AUTs running at the same time, but you can only be connected to one at a time. To switch between AUTs, you must disconnect from one and reconnect to another. Both AUTs can still be running though. In terms of "bringing the AUT to the foreground" : we don't currently have an action for this. There are various workarounds you can use, or you can write some non-Jubula Java code to bring an application into the foreground.

I am unsure of what the problem could be regarding the mismatch of types: can you post your code snippets for the activation method?

Question 2
There currently isn't a good way to get at the Text of something. A (not nice) workaround is mentioned here. Feel free to enter an enhancement in the Jubula bugzilla for this feature.

Question 3
For the conversion:
- Have you read the documentation?
- Bear in mind as well that the converter is experimental and is designed as a help for pre-existing projects to convert. It is not designed as a way of continually migrating a growing ITE project to the API. If you are just starting out with Jubula and want to use the API. I'd recommend writing your tests directly in the API.

Question 4
The payload is an optional parameter that you can use to send information. You can see one of its uses in the example in the developer manual. You can send anything in it, we don't check its content - just pass it on. For the result part - I'd recommend setting up one of the examples from the FAQ mentioned above and seeing what happens there. The Check Failed exception you refer to is simply that a check you have carried out has failed (e.g. you wanted to check that abc is in a field, but the field doesn't contain that string).

Hope that helps,

Previous Topic:Ignoring regex on a parameter
Next Topic:Mapping technical names
Goto Forum:

Current Time: Wed Feb 21 16:38:52 GMT 2024

Powered by FUDForum. Page generated in 0.02533 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top