Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Migrating Tests from 1.5 to 2.0
Migrating Tests from 1.5 to 2.0 [message #1466873] Sun, 09 November 2014 10:51 Go to next message
Eclipse UserFriend
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 #1473977 is a reply to message #1466873] Fri, 14 November 2014 22:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi Team,

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
Re: Migrating Tests from 1.5 to 2.0 [message #1474239 is a reply to message #1473977] Sat, 15 November 2014 03:17 Go to previous message
Eclipse UserFriend
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/
Previous Topic:Nebula Grid missing GridTableViewer and GridTreeViewer
Next Topic:Relative width of elements / page
Goto Forum:
  


Current Time: Tue Jul 15 01:49:44 EDT 2025

Powered by FUDForum. Page generated in 0.06625 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top