API for opening Eclipse views

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

API for opening Eclipse views

Postby jluebker » Thu Jul 02, 2009 11:31 am

Hello,

I am new to using WindowTester and am still getting familar with the APIs. Is there an existing API that allows opening of Eclipse views? I have found the various Eclipse locator APIs which provide a way to easily determine if a particular Eclipse view is closed, showing, active and etc. Is there a similar API that allows opening of Eclipse views if they are not currently open? I realize that I could use the recorder feature to navigate through menus to open a view. I think in some instances it might be better to have a quick way to open Eclipse views without relying on manipulating menus.

Thanks,
Joe
jluebker
 
Posts: 15
Joined: Thu Jul 02, 2009 11:17 am

Re: API for opening Eclipse views

Postby Phil Quitslund » Mon Jul 06, 2009 12:43 pm

Hi Joe,

You can use the EclipseLocators.view condition factory to create an ensureThat statement that will do the trick. For example, if you want to ensure that the "Search" view is visible, try this:

Code: Select all
import static com.windowtester.runtime.swt.locator.eclipse.EclipseLocators.view;
import com.windowtester.runtime.swt.UITestCaseSWT;

public class MyTest extends UITestCaseSWT {

   protected void setUp() throws Exception {
      super.setUp();
      getUI().ensureThat(view("Search").isShowing());
   }
}
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

Re: API for opening Eclipse views

Postby jluebker » Tue Jul 07, 2009 8:56 am

Thanks for the response. That does look like an easy/clean way to determine if a particular Eclipse view is open.

Unless I am mistaken, it doesn't look like it will actually do the work of opening an Eclipse view if it isn't already showing. There is of course is a limit to exactly what the WindowTester APIs are going to provide to testers. There are some common and general Eclipse UI manipulations (such as opening/closing views, editors, perspectives and such) that could possibly be included in the WindowTester APIs. Not being completely familiar with the WindowTester APIs yet, I thought it would be best to ask the experts about the existence of any such APIs before spending time creating utilities in our test environment.

Thanks,
Joe
jluebker
 
Posts: 15
Joined: Thu Jul 02, 2009 11:17 am

Re: API for opening Eclipse views

Postby Phil Quitslund » Thu Jul 09, 2009 8:34 pm

Hey Joe,

Actually, the idea behind ensureThat is indeed to make such condtions become true so this should work whether the view is open or not.

http://downloads.instantiations.com/WindowTesterDoc/integration/latest/docs/html/reference/javadoc/com/windowtester/runtime/IUIContext.html#ensureThat%28com.windowtester.runtime.condition.IConditionHandler%29

Please let us know if you experience otherwise!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest