Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344222

Summary: AUT activation issue
Product: [Technology] Jubula Reporter: Vladimir <vladimir_krutenev>
Component: CoreAssignee: Project Inbox <jubula.core-inbox>
Status: CLOSED WONTFIX QA Contact: Oliver Goetz <Oliver.Goetz>
Severity: major    
Priority: P3 CC: alexandra.schladebeck, phil.m.fischer
Version: unspecified   
Target Milestone: 1.0   
Hardware: All   
OS: All   
Whiteboard:

Description Vladimir CLA 2011-04-28 21:01:42 EDT
1) Start AUTs Eclipse Galileo and Ganymede via autrun
2) Put one AUT window on top of another
3) Create Test Job
4) Add test case to you test job
5) Execute test job. Test runs on visible AUT (most top window) but hidden one.
6) If you block yours AUTs by any other window your test is failed

Jubula must activate AUT before running test. I tried to use ub_app_activate w/o any success.
Comment 1 Vladimir CLA 2011-04-28 21:02:20 EDT
Behavior is the same on Mac and Windows.
Comment 2 Alexandra Schladebeck CLA 2011-04-29 03:49:19 EDT
An automatic platform and toolkit-independent activation of AUTs that are minimized or in the background would be an extremely tricky and likely brittle thing to implement (AFAIK Java has no call for it). 

Some links I found on the topic:

http://www.tek-tips.com/viewthread.cfm?qid=325003&page=278

http://download.oracle.com/javase/tutorial/uiswing/misc/focus.html
(This one is for Swing, but the outlook for SWT is no better from what I could see).

When writing test jobs, it is advisable to have a module that ensures that the correct application is in the foreground. This can be achieved e.g. by using a "click in active window" action which fails (with an action error) if the desired AUT is not at the front. A retry Event Handler can react to it and perform Alt+Shift+Tab. This loop can continue until the correct application is activated. Due to the use of the "Retry" Event Handler, the test is marked as successful for this loop.

I have seen and used this approach for both Windows and Linux systems. On Mac, the default key combination is Ctrl+F4. You could use this, but it would mean splitting your tests up. I would suggest that you change the default key combination on Mac to match the Windows and Linux one and make your tests all run the same.

I'm setting this to WONTFIX for the reasons above. If you (or anyone else reading this) has a good idea or a patch that could help for Swing, SWT or HTML on all platforms, then feel free to reopen the bug.
Comment 3 Oliver Goetz CLA 2011-06-07 04:59:42 EDT
Closed won´t fix
Comment 4 Phil F. CLA 2011-11-11 10:50:55 EST
In my opinion this issue should be reconsidered...

Currently I am facing the same issue running several instance of my AUT on one build-node. Windows are covered and cannot be reactivated.

The fix with alt tab does not work. Running on a Win 7 node, it is not handled as a queue, it is just swapping between two windows all the time...

Cheers

Phil
Comment 5 Alexandra Schladebeck CLA 2011-11-11 11:00:28 EST
For windows 7, you might want to look at this forum entry where a tweak to the Windows settings is described that makes the Alt+Shift+Tab solution work.
Comment 6 Alexandra Schladebeck CLA 2011-11-11 11:00:52 EST
Oh, and here is the forum thread ;)

http://www.eclipse.org/forums/index.php/t/238562/