Migrating Tests from 1.5 to 2.0 [message #1466873] |
Sun, 09 November 2014 10:51  |
Eclipse User |
|
|
|
Hi RAP team,
We're in the process of migrating our code base from RAP 1.5 to 2.0.
One part that needs adjustments is the way we run our tests.
As we understand in 2.0 we don't need RAP JUnit test to run our tests
instead we can use plain JUnit
To prove it we run a very small test below which always fails:
public class TestComposite
{
private Display display;
private Shell shell;
@Before
public void setUp() throws Exception
{
Fixture.setUp();
Fixture.fakePhase(PhaseId.PROCESS_ACTION);
display = new Display();
shell = new Shell(display, SWT.NONE);
}
@After
public void tearDown() throws Exception {Fixture.tearDown();}
@Test
public void testSelectionAdapterInvocation() throws Exception
{
Button button = new Button(shell, SWT.CHECK);
SelectionListener listener = mock(SelectionListener.class);
button.addSelectionListener(listener);
shell.open();
button.setSelection(true);
verify(listener).widgetSelected(any(SelectionEvent.class));
shell.close();
}
}
Do we miss something ?
Any help would be greatly appreciated.
Thanks & Regards,
Setya
|
|
|
|
Re: Migrating Tests from 1.5 to 2.0 [message #1474239 is a reply to message #1473977] |
Sat, 15 November 2014 03:17  |
Eclipse User |
|
|
|
Hi Setya,
setting button CHECK/RADIO button selection by code does not trigger the
selection listener in SWT/RWT. If you want to simulate user action try:
---
Fixture.fakeNotifyOperation( WidgetUtil.getId( button ),
ClientMessageConst.EVENT_SELECTION, null );
Fixture.readDataAndProcessAction( button );
---
All RWT tests (org.eclipse.rap.rwt.test bundle with 7000+ tests) are
plain JUnit tests and they are working without problem.
HTH,
Ivan
--
Ivan Furnadjiev
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Powered by
FUDForum. Page generated in 0.06625 seconds