RWTBot

Recently I started working at a headless client for RAP 2.0 with the following aims:

  • Allow functional testing of RAP/RWT applications.
  • Allow stress testing of RAP/RWT applications, working together with a performance test library.

A secondary requirement is to:

  • Be similar enough to the SWTBot API so that the effort for testing single-sourced applications is minimal

which gives this project the name RWTBot.

ScreenSnapz051 300x126 RWTBotThe following example test connects to the RWT Controls Demo and tests the toggle button functionality:

@Test
public void selectToggleButton() throws Exception {
  String rwtAppUrl = "http://rap.eclipsesource.com/controlsdemo/controls";
  RWTBot bot = new RWTBot(new RWTBotClientParameters(rwtAppUrl));
  RWTBotDisplay session = bot.startSession(); // 1. handshake
  RWTBotShell shell = session.shell(); // 2. identify the main window
  RWTBotButton observed = shell.button("Toggle"); // 3. Find a button named "Toggle"
  assertFalse(observed.getSelection()); // 4. check precondition
 
  shell.button("Toggle Button").click(); // 5. trigger UI change
 
  assertTrue(observed.getSelection()); // 6. check post condition
}

During the test, this happens inside RWTBot:

  1. The initial handshake is executed with the RWT Demo. This opens a RAP session and a display is created. All widgets on the main screen are received. RWTBot control handlers for roughly 100 controls are created and configured.
  2. Initially there is just the main window. This is identified and the RWTBot handle is received.
  3. The main window has a button named “Toggle”. A handle for the button is received and remembered as a local variable. It will reflect the state change in the UI.
  4. Assert that the precondition is as expected, ie. that the toggle button is deselected.
  5. The “Toggle Button” is clicked. This is sent to the server which responds with changes for the UI. These changes include the activation of the observed button.
  6. Assert that the postcondition is as expected, ie. that the toggle button is activated.

Did I miss any design criteria for RWTBot? Are you interested in a working RWTBot? Leave a comment or email me to let us know.

 

 

 

3 Responses to “RWTBot”

  1. hangum says:

    woooooooooooow, very good. very surprising.

  2. Markus says:

    Hi,
    nice work.
    Is there a download available somewhere?

    Regards, Markus

  3. Ingo Meyer says:

    This would be a great wanna-have, especially for Performance Testing.
    Very good idea!

3 responses so far

Written by . Published in Categories: EclipseSource News, Planet Eclipse

Author:
Published:
Nov 15th, 2012
Bookmark: