How to recognize a shell on the desktop for testing using swtbot?

227 views Asked by At

I have an application that generates an SWT UI (with a text entry field and two buttons, similar to eclipse workspace selector). I want to generate test cases for this using SWT bot. I get the application to run using java (by executing the double click event). Then my application will generate the UI of and I want to recognize this UI from SWT bot test class. How can I recognize this when the UI is up?

I have written a unit test by invoking the method that creates the UI separately, but this is an integration test in which i need to test the whole flow of the application similar to user experience.

thanks in advance

1

There are 1 answers

0
coder11 On

I hope you installed SWTBot ide integration from an update site like http://download.eclipse.org/technology/swtbot/releases/latest/

If you want to run the SWTBot testcase from Eclipse do following:

  1. Open Run->Run Configurations
  2. Find SWTBot Test node on left of the configurations dialog
  3. Create new configuration with right click on the node.
  4. Select your test class/method/package/folder on Test tab, choose JUnit 4
  5. Select your application/product on Main tab.
  6. Select the dependencies you application requires on Plugins tab. There you go Run :)

It is highly probable you'll fail at first attempt. In that case on Plugins tab click on "Validate Plug-ins" and make sure you get the message "No problems were detected" or something like that.