Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot for custom SWT control
SWTBot for custom SWT control [message #1000772] Tue, 15 January 2013 07:13 Go to previous message
Dirk Fauth is currently offline Dirk Fauth
Messages: 516
Registered: July 2012
Senior Member
Hi,

I created a custom SWT control that contains of two TreeViewers, supporting moving items from left to right and vice versa. I am planning to contribute this to Nebula, but before that, I need to fix some special issues related to TreeViewers.

Said that, I wanted to add several test cases, using SWTBot. But I can not figure out how to get the test cases running with SWTBot.

Maybe I'm just missing some basic parts, but everything I find searching the web is related to Eclipse applications using the workbench. Of course I could create a small example application that consists of just a part with that composite. But shouldn't it be possible to test plain SWT? At least I read that it is possible, but with no examples.

Running the test cases as pure JUnit test out of Eclipse will cause an exception telling me the Realm can not be null. This is because I use databinding in the back.

In some example code I wrote, I solved it this way in a main method
final Display display = Display.getDefault();
final Shell shell = new Shell(display, SWT.SHELL_TRIM);
shell.setLayout(new FillLayout());
shell.setSize(400, 300);
shell.setText("Tree chooser example");

		
Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
	public void run() {
		new TreeChooserExample(true).createControl(shell);
				
		shell.open();
				
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}
});


But how to solve this with SWTBot?

Any help is appreciated.

Greez,
Dirk
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Do you want a recorder for SWTBot ?
Next Topic:How to using Enter key on a text box
Goto Forum:
  


Current Time: Sat May 18 19:08:42 EDT 2013

Powered by FUDForum. Page generated in 0.01589 seconds