Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Jubula » Testing viewAction items
Testing viewAction items [message #696599] Thu, 14 July 2011 11:25 Go to next message
Niels K is currently offline Niels KFriend
Messages: 17
Registered: July 2011
Junior Member
Hi,

I have a problem using Jubula to test a an eclipse plugin that realizes toolbar items using the viewActions extension point (org.eclipse.ui.viewActions).
Automating the usage of such elements simply fails.
On the other hand, I can collect theese items with the object mapper and it recognizes the technical type (org.eclipse.swt.widgets.ToolItem).

Those viewActions-elements are used in a lot of standard eclispe elements (for example in the 'console' the buttons: 'Close CSV consol', 'Clear console' etc.) and I assume that the Jubula specific 'Start Test Execution (Crtl+J)'-Item is realized with viewActions, too. Right?

So I wonder how to test theese elements. It must be possible and someone must have done this since it says "Jubula is tested with Jubula".

Can anybody help me out?
Thanks for your help!
Niels
Re: Testing viewAction items [message #696613 is a reply to message #696599] Thu, 14 July 2011 12:00 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Hi Niels,

If you are referring to the buttons as shown in the image I've attached, then you should be able to test them as follows:

Any item without a drop-down list can be clicked using the normal click action (e.g. ub_grc_clickLeft_Single)

Any items with drop down lists can be tested using the module from the "unbound modules SWT" library for selecting from Toolbar Items. The action you'll need is:
ub_tbi_selectMenuEntry (either by textpath or by indexpath). The action clicks the button and selects from the drop down menu.

Hope this helps!

Alex
Re: Testing viewAction items [message #696626 is a reply to message #696613] Thu, 14 July 2011 12:36 Go to previous messageGo to next message
Niels K is currently offline Niels KFriend
Messages: 17
Registered: July 2011
Junior Member
Hi Alex,

thanks for your answer.
Yes, I'm referring to this type of button. And exactly the actions you've mentioned are not working. I've also tried to record and replay the test step but without success.
The event handler is of the type "Component Not Found Error".

Thanks for your help.
Niels
Re: Testing viewAction items [message #696720 is a reply to message #696599] Thu, 14 July 2011 17:34 Go to previous messageGo to next message
Niels K is currently offline Niels KFriend
Messages: 17
Registered: July 2011
Junior Member
Hi Alex,

I did a very short test with a 'normal' eclipse version, not a version with my own plugins, to give a replicable reference to my problem.

I'll try to give very detailed information, maybe there a small stupid mistake I've done.

- I use Eclipse for testers (indigo version) as AUT with Jubula 0.9.0 standalone

- I Created a new test:
- I configured rcp as Toolkit for test specification as well as for AUT toolkit
- I installed the RCP plugin in Eclipse for testers
- I start the AUT via Jubula. The correct ID appers in the 'Running AUTs'-Window, in the AUT (Eclipse for testers) the 'Functional Test Specification'-Perspective is activated
- I create a new Test Case and open it
- I start the observation mode
- I did the following steps:
- Click on the 'New'-Pull-down-button in the upper left
- Select 'project...' -> The "New Project"-Window apperas
- Click 'Cancel' in the Window that appeared
- Click on the Pull-down-button in the Console-Window
(Exactly the button as posted in the picture in Alex' reply above)
- Select '1 Java Stack trace console' -> The view apperas
- I stop the observing Test Case
- I the screenshot I provied with this post, one can see the recorded steps.
- I save the test case, create a new test suite, add the test case to it, save it and start it.
- The "New"-WizardDropDownMenu is select correctly
- The test fails on the Toolbaritem (please see screenshot)

As Alex posted, it shall be possible to do theese steps. So I assume I have I small mistake, an error in reasoning or forgotten a detail of Jubula or what ever.

Any ideas or can anybody replicate this test (fail or not either way)
I'm grateful for any help.
Many thanks!
Niels



Re: Testing viewAction items [message #696958 is a reply to message #696720] Fri, 15 July 2011 08:13 Go to previous messageGo to next message
Alexandra Schladebeck is currently offline Alexandra SchladebeckFriend
Messages: 1613
Registered: July 2009
Senior Member
Hi Niels,

Thank you for the extra information.

I had a look at the behaviour using an Eclipse 3.6 build as the AUT and noticed the following:

The object map for the toolbar items (whether they are with drop down menus or not) seems to be dependent on the number of items in the view toolbar. (If you go into the mapping mode and remap the item, you'll see that you get alternately e.g. toolitem_6 or toolitem_3, depending on how many items are visible - and the number of items changes depending on what you select in the view). Our mapping generates a name, but at some point this name is dependent on the order / amount of items in the final container if no other identifiers are available for differentiation.

For dynamically added components such as these, which can only be differentiated by their number, it would be worthwhile adding given names for them in the application. You can use the method setData(String key, String ComponentName) (described in the user manual in chapter 4.2.4) to set unique names for such components. This will mean that the components are found regardless of their order and number.

You can also put an issue into bugzilla for this if you want to, however, I'm not 100% sure what identifiers we could automatically generate for situations such as these.

Hope this helps!
Alex
Re: Testing viewAction items [message #697053 is a reply to message #696599] Fri, 15 July 2011 12:17 Go to previous messageGo to next message
Niels K is currently offline Niels KFriend
Messages: 17
Registered: July 2011
Junior Member
Hi Alex,

thanks for your answer.

As most of our components are generated through the eclipse extension automatically, they have specific names corresponding to the package and class, for example "com.company.project.eclipsePlugin.aSpecificTopic.theSpecificClassName" and the object mapper recognizes this string as the technical name, indeed.

Thinking about your remarks about names and the documentation about component name generation made me try to deactivae the 'Generate Names' function in the AUT properties ... and ... this works! (after remapping the object)
The automatic name generation seems to be the problem in the case.
Thank you for the hint!

Now I am in a discord: I can waive the automatic generation of names in jubula for my plugin fuctions as I can ensure that all components have given names in the code. But I cannot assure this for eclipse in general.

I this context wouldn't it be a useful feature to allow a decision to generate names for every component besides a project level default setting?

Furthermore, all my object mapping will be lost when I change the setting to generate names in the project. Sad

Your answer was very helpful but the solution opens up a new problem (no worry, I'm used to this).

Regards,
Niels
Re: Testing viewAction items [message #702372 is a reply to message #696599] Tue, 26 July 2011 09:28 Go to previous messageGo to next message
Niels K is currently offline Niels KFriend
Messages: 17
Registered: July 2011
Junior Member
Hi,

my last post was hasty. The object recognition is not dependend from the "Generate names" flag status. Sorry for the wrong information.

My latest observation is:
I can map a toolbar item in a fresh installation and a test works with this object. When I perform a perspective reset, the window arrangement changes a little. With the object mapper I can assure that the "Technical name" does not change yet the test fails with a "component not found" error.
With some changes in the "Object recognition profile" (Name Weight to 100%) the test performs well again.

This works for toolbar items with static names, but leads to problems with thoose items with dynamically given names .
Therefore I must assure that all my components have static names.
Following your recommondation, I placed a setData-Call in my code for a text field, that has a "dynamic" "Technical Name" (org.eclipse.swt.widgets.Text_1):

Composite content = new Composite(parent, SWT.NULL);
content.setData("TEST_COMP_NAME", TextFilterControl.class.getName());

I expected to find that name as the "Technical Name" in the object properties, but it remains org.eclipse.swt.widgets.Text_1.

Two questions:
1) Is my expectation correct and is there a mistake with the setData-method in my code or does the TEST_COMP_NAME not affect the technical name (in Jubula)?

2) And if so, can I find the test_comp_name in Jubula?

Thanks for your help,
Niels
Re: Testing viewAction items [message #710776 is a reply to message #696599] Fri, 05 August 2011 11:53 Go to previous message
Niels K is currently offline Niels KFriend
Messages: 17
Registered: July 2011
Junior Member
Hi,
I'm still having problems with this situation. Afer experimenting I've got some new insights.
I'll outline the situation:

- My AUT is a eclipse version with my own plugin

- In my AUT, there is a special window, let's call it 'MyWindow'

- 'MyWindow' contains some ToolbarItems, let's say 'MyTBI_1', 'MyTBI_2', 'MyTBI_3'

- I map theese items with the object mapper. It recognizes them with their specific names 'MyTBI_1', 'MyTBI_2', 'MyTBI_3', not with any generic, dynamically generated names. (I addition to that, I have given the test_comp_name property to theese items with the setData method, but cannot see this anywhere, as I reported in my last post).

- I create a test to click on theese items and put this test in a test suite.

- I run the test, while in my AUT the window 'MyWindow' is visible -> The test suite runs successfully.

- Now I perform manually: 'Windwow->Reset perspectiove' ('MyWindow' disapperas) and 'Window->Show View' ('MyWindow' reappers)

- I run the test again -> The test runs successfully again.


- Now I want to do the reset in within the test. I extend the test to do:
- click on the toolbar items
- Reset perspective
- Show View: Mywindow
- Click on the toolbar items

- I run the test suite. The first click on the toolbar items is ok, the second on after the reset fails.

- This behavior repeats when I start the test suite again.

Any idea why this is happening? It seems as there is any mapping made at the start of the test and something changes with the reset perspective command. But when I remap the toolbar items, no property has changed.

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

I addition to this:

- Now I create a test job and put my test suite in it and run it -> It fails on the first click on the toolbar items, with was successful when I started the test suite dirctly, not through a test job. Hä? Now I'm totally confused.

Any suggestions for a workaround?

Thanks for your help,
Niels
Previous Topic:Error Check text in TextArea
Next Topic:Eclipse Testing Day
Goto Forum:
  


Current Time: Thu Apr 25 11:49:10 GMT 2024

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

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

Back to the top