Fails to find and click tree item

WindowTester allows you to easily create and run unit tests for every GUI they build. It can also be used to generate system level tests.

Moderators: gnebling, Eric Clayberg, Dan Rubel, keertip, Phil Quitslund

Fails to find and click tree item

Postby lars » Thu Feb 10, 2011 4:35 am

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, gives SWTUIException. The specific code:
-, 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();, 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")); ButtonLocator("OK"));
ui.wait(new ShellDisposedCondition("Confirm Exit"));
ui.wait(new ShellDisposedCondition("Eclipse Platform"));

System.out.println("testTest12, end");

Part of stack trace:
com.windowtester.runtime.swt.internal.widgets.SWTUIException: Exception occurred on the SWT UI Thread
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
Posts: 1
Joined: Thu Feb 10, 2011 3:45 am

Re: Fails to find and click tree item

Postby gnebling » Tue Feb 22, 2011 2:51 pm

I was wondering if the "testProject/temp.txt" directory tree is actually there when the test runs. Otherwise, you'll need to include the script for creating the testProject and the temp.txt file. Could you post a screen shot when the test runs?
Posts: 243
Joined: Tue Aug 22, 2006 7:49 am

Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest