NullPointerException in dragTo method

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

NullPointerException in dragTo method

Postby fcoat » Mon Mar 07, 2011 7:27 am

Hello,

Using a custom locator MDSFigureLocator returning a org.eclipse.draw2d.Figure, and trying to do a drag & drop, an exeption org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) is thrown:

Code: Select all
public void testDragAndDrop() throws Exception {
   IUIContext ui = getUI();
   MDSFigureLocator source = new MDSFigureLocator(new ColumnMatcher("CUSTORDERLINE", "PRODUCTID"));
   MDSFigureLocator dest = new MDSFigureLocator(new ColumnMatcher("DIMPRODUCT", "PRODUCTID"));
   System.out.println("*** source: " + source.findAll(ui).length);  // displays "*** source: 1"
   System.out.println("*** dest: " + dest.findAll(ui).length);  // displays "*** dest: 1"
   ui.click(source);  // works fine, the widget is properly clicked
   ui.pause(500);
   ui.dragTo(dest);  // fails with the exception below
}


org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:3777)
at org.eclipse.swt.SWT.error(SWT.java:3695)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:194)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4251)
at com.windowtester.runtime.draw2d.internal.helpers.FigureSelectorHelper.ensureRunOnUIThread(FigureSelectorHelper.java:226)
at com.windowtester.runtime.draw2d.internal.helpers.FigureSelectorHelper.scrollForClick(FigureSelectorHelper.java:342)
at com.windowtester.runtime.draw2d.internal.selectors.FigureSelectorDelegate.dragTo(FigureSelectorDelegate.java:110)
at com.windowtester.runtime.swt.internal.UIContextSWT.dragTo(UIContextSWT.java:440)
at test.businessobjects.bimodeler.rcp.framework.testDragAndDrop(testDragAndDrop.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at com.windowtester.runtime.common.UITestCaseCommon.access$0(UITestCaseCommon.java:1)
at com.windowtester.runtime.common.UITestCaseCommon$2.run(UITestCaseCommon.java:130)
at com.windowtester.runtime.common.UITestCaseCommon$3.run(UITestCaseCommon.java:151)
at com.windowtester.internal.runtime.junit.core.SequenceRunner$1.run(SequenceRunner.java:40)
Caused by: java.lang.NullPointerException
at com.windowtester.runtime.draw2d.internal.helpers.FigureSelectorHelper$2.run(FigureSelectorHelper.java:270)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
at com.windowtester.runtime.swt.internal.junit.SWTExecutionMonitor.doWaitForFinish(SWTExecutionMonitor.java:151)
at com.windowtester.internal.runtime.junit.core.AbstractExecutionMonitor.waitUntilFinished(AbstractExecutionMonitor.java:205)
at com.windowtester.internal.runtime.junit.core.SequenceRunner.waitUntilFinished(SequenceRunner.java:69)
at com.windowtester.internal.runtime.junit.core.SequenceRunner.exec(SequenceRunner.java:53)
at com.windowtester.runtime.common.UITestCaseCommon.runUITest(UITestCaseCommon.java:147)
at com.windowtester.runtime.common.UITestCaseCommon.runBare(UITestCaseCommon.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
...


Is there a way to go around this issue ?

Thanks,
Fabien
fcoat
 
Posts: 4
Joined: Thu Feb 17, 2011 10:53 pm

Re: NullPointerException in dragTo method

Postby fcoat » Thu Mar 10, 2011 7:28 am

Any news regarding this issue ?
BTW, I am using WT 6.0 for Eclipse 3.4.

Thanks,
Fabien
fcoat
 
Posts: 4
Joined: Thu Feb 17, 2011 10:53 pm

Re: NullPointerException in dragTo method

Postby keertip » Mon Mar 28, 2011 8:28 am

Do you have some sample code and test that you could post so that we can reproduce this problem at our end? That would help a lot.
keertip
Moderator
 
Posts: 221
Joined: Thu Mar 15, 2007 10:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest

cron