Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsMigrating Tests from 1.5 to 2.0
https://www.eclipse.org/forums/index.php/mv/msg/850965/1466873/#msg_1466873
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);
Thanks & Regards,
Setya]]>Setya Nugdjaja2014-11-09T15:51:46-00:00Re: Migrating Tests from 1.5 to 2.0
https://www.eclipse.org/forums/index.php/mv/msg/850965/1473977/#msg_1473977
Anyone can reproduce the problem ?
Regards,
Setya
On 11/09/2014 10:51 PM, Setya wrote:
> 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]]>Setya Nugdjaja2014-11-15T03:04:23-00:00Re: Migrating Tests from 1.5 to 2.0
https://www.eclipse.org/forums/index.php/mv/msg/850965/1474239/#msg_1474239
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