سؤال

I'm using WindowTester to automate testing of an Eclipse RCP application. When I try to automate menu interaction like this:

IUIContext ui = getUI();
ui.click(new MenuItemLocator("Window/Show View/My View"));

I get an exception.

com.windowtester.runtime.WidgetNotFoundException: No menubar found for active shell

The menubar exists, of course. It is created by Eclipse. I contribute to it via an extension point under org.eclipse.ui.commands.

How can I automate interaction with these menu items?

هل كانت مفيدة؟

المحلول

The test thread is getting ahead of the UI thread. The menubar doesn't yet exist when the MenuItemLocator looks for it. Add a delay to ensure that the application has finished initializing before starting the test.

ui.wait(new ShellLocator("Application Title").isVisible());
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top