Seems that "new TreeItemLocator()' fails to find tree item. Suppose this concerns more than just me. And hopefully there are ideas how to go past this obstacle. Using Explorer-like navigation is fairly common in applications which is why I suspect this is solved somehow as it should be testable with WindowTester.
Using WindowTester to test an Eclipse Application - RCP. Test records ok but throws Exception when run. When run, ui.click gives SWTUIException. The specific code:
- ui.click(2, new TreeItemLocator("testProject/temp.txt", new ViewLocator("org.eclipse.jdt.ui.PackageExplorer")));
Same exception from the original project. I've tried to isolate possible faulty things but so far no success. First I created a project environment (path) with as few /,\-characters as possible, then without space in path. Problem remains. Current test project (in package explorer):
- testProject
- src
- JRE System Library
- temp.txt
The recorded test (2 rows added):
public void testTest12() throws Exception {
IUIContext ui = getUI();
ui.click(2, new TreeItemLocator("testProject/temp.txt", new ViewLocator("org.eclipse.jdt.ui.PackageExplorer")));
ui.ensureThat(new CTabItemLocator("temp.txt").isClosed());
ui.ensureThat(new ShellLocator("Java - Eclipse Platform").isClosed());
ui.wait(new ShellShowingCondition("Confirm Exit"));
ui.click(new ButtonLocator("OK"));
ui.wait(new ShellDisposedCondition("Confirm Exit"));
ui.wait(new ShellDisposedCondition("Eclipse Platform"));
System.out.println("testTest12, end");
assertTrue(true);
}
Part of stack trace:
com.windowtester.runtime.swt.internal.widgets.SWTUIException: Exception occurred on the SWT UI Thread
at com.windowtester.runtime.swt.internal.widgets.SWTUIExecutor.run(SWTUIExecutor.java:101)
...
at com.bombardier.ebitool.data.ebilink700900.Test12.testTest12(Test12.java:31)
...
Caused by: java.lang.IllegalArgumentException: Cannot create a widget reference for null
...
Looking into "new TreeItemLocator()" indicates that item is not found. And this will of course cause trouble when trying to simulate a click.
I have not been able to find solution to this. Looked in forum and in other web pages. Ideas?
Best regards
Lars