TESTING TOOL FOR SWT

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

TESTING TOOL FOR SWT

Postby raghavan_26 » Sun Oct 08, 2006 9:48 pm

hi all,
I am raghavan . i am new to this forum ..
i want to just know if any one can help me out in generating a test case using eclipse TPTP tool i am unable to generate test case for the following class



import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;



public class SWTSimpleTree {
Display display = new Display();
Shell shell = new Shell(display);

Tree tree;

/**
* Constructor for SWTSimpleTree.
* @param name
*/



public SWTSimpleTree() {
shell.setLayout(new GridLayout());

tree = new Tree(shell, SWT.BORDER);

tree.setLayoutData(new GridData(GridData.FILL_BOTH));

TreeItem item = new TreeItem(tree, SWT.NULL);
item.setText("ITEM");

TreeItem item2 = new TreeItem(item, SWT.NULL);
item2.setText("ITEM2");

TreeItem item3 = new TreeItem(item2, SWT.NULL);
item3.setText("ITEM3");

System.out.println("item: " + item.getParent() + ", " + item.getParentItem());
System.out.println("item2: " + item2.getParent() + ", " + item2.getParentItem());

System.out.println(tree.getItemCount());
System.out.println(tree.getItems().length);

shell.setSize(300, 200);
shell.open();
//textUser.forceFocus();

// Set up the event loop.
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
// If no more entries in event queue
display.sleep();
}
}

display.dispose();
}

// private void init() {
//
// }

public static void main(String[] args) {
new SWTSimpleTree();
}

}
The test case should navigate through complete tree structute .
like it should ist test wether item is being set correctly or not then the item2 and so on .....

I wanted to just ensure wether this is possible using TPTP tool or not ,
If no what is the other possible tool for testing such code.

Thanks inadvance
raghavan
raghavan_26
 
Posts: 7
Joined: Thu Oct 05, 2006 9:12 pm

Postby Phil Quitslund » Mon Oct 09, 2006 6:29 am

Hi Raghavan,

I don't think TPTP's AGR (Automated GUI Recorder) will work with this application. The AGR works striclty with Eclipse appplications and does not support standard stand-alone SWT apps. Of course, perhaps you should post the question to a TPTP list to confirm?

As for tools that would work, WindowTester is designed with SWT apps in mind. The WindowTester recorder and runtime should handle this scenario without any problems.

Give it a try and let us know how it goes. We'll be happy to help if you hit any snags!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am

hii

Postby raghavan_26 » Mon Oct 09, 2006 7:28 pm

I am grt full for Your valuable sugession which really helped me a lot ...
I have tried using windows tester too.. I could get the test case generate but i couldn't Run the test case that was the only problem ,

Anyway i will find out the ways to do that

Thanks for your valuable suggession
by
raghavan
raghavan_26
 
Posts: 7
Joined: Thu Oct 05, 2006 9:12 pm

Postby Phil Quitslund » Tue Oct 10, 2006 6:28 am

Tell us more about what happened when you tried to run the generated test and maybe we can help!
--
Phil Quitslund
Software Engineer
Google, Inc.
Phil Quitslund
Moderator
 
Posts: 491
Joined: Fri Apr 28, 2006 6:26 am


Return to Window Tester

Who is online

Users browsing this forum: No registered users and 1 guest