Hello!
I experience the same bug! I tried to change back to version 1.3 but stuck
with the same bug! However, running it several times I got a failure rate of
50%...
It seems that SWTBotTestCase creates a ControlFinder which tries to find a
display... But how should it find a display which is not created yet??
My sample is so simple, that it seems to be something serious!?
My window:
public class MainWindow {
Display display;
Shell shell;
/**
* Kommentar
*
*/
public void show() {
display = new Display();
shell = new Shell(display);
shell.setText("Window");
shell.open();
while (!shell.isDisposed()) {
display.readAndDispatch();
display.sleep();
}
display.dispose();
}
}
My test:
public class MainWindowTest extends SWTBotTestCase {
static {
System.out.println("tets");
startApplicationInAnotherThread();
}
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
waitForDisplayToAppear(5000);
super.setUp();
}
public void testSwtUI() {
System.out.println("Test Passed");
}
private void waitForDisplayToAppear(long timeOut) throws
TimeoutException,
InterruptedException {
long endTime = System.currentTimeMillis() + timeOut;
while (System.currentTimeMillis() < endTime) {
try {
Display display = SWTUtils.display();
if (display != null)
return;
} catch (Exception e) {
System.out.println("egal");
}
Thread.sleep(100);
}
throw new TimeoutException("timed out");
}
private static void startApplicationInAnotherThread() {
new Thread(new Runnable() {
public void run() {
try {
new MainWindow().show();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
Veneet wrote:
>
> Hi guys,
>
> The code i posted in The previous Thread ran suddenly and when i tried
> to executr it again it crashed throwing the same Exception as before
>
> chk this out::
>
> http://www.nabble.com/file/p19990466/Bug1.gif
>
>
> The Test Ran succesfully
> Any info on this??
>
>
> Bye
> Veneet
>
--
View this message in context:
http://www.nabble.com/Hit-a-BUg-in-SWTBot-2.0-tp19990466p20045175.html
Sent from the SWTBot Users List mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse