Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » SWTBot test wizard without workbench(SWTBot test wizard without workbench)
icon5.gif  SWTBot test wizard without workbench [message #999155] Fri, 11 January 2013 13:18
christin nitsche is currently offline christin nitscheFriend
Messages: 1
Registered: January 2013
Junior Member
I created an eclipse wizard which i want to test now with the SWTBot. I already used the SWTWorkbenchBot which finally works but i want to test the wizard now without the eclipse workbench. Thats why i created a shell in my testclass where i want to put on my wizardpage, but all i could see, was a empty shell without my wizardPage.

So i created a new shell class which included this code:

	public static void main(String args[]) {
		try {
			Display display = Display.getDefault();
			HorrorShell shell = new HorrorShell(display);
			shell.open();
			shell.layout();
			while (!shell.isDisposed()) {
				if (!display.readAndDispatch()) {
					display.sleep();
				}
			}
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the shell.
	 * 
	 * @param display
	 */
	public HorrorShell(Display display) {
		super(display, SWT.SHELL_TRIM);
		setLayout(new FillLayout());

		createContents();
	}

	/**
	 * Create contents of the shell.
	 */
	protected void createContents() {
		setText("SWT Application");
		setSize(450, 300);
		ManualSettingsWizardPage page = new ManualSettingsWizardPage();
		page.createControl(this);
	}


With the shell class it works, my wizardpage was shown but if i try to run my testclass as SWTBotTest or as JUnitTest it wont show me anything but a empty shell.
Here's the code in my testclass:

private ManualSettingsWizardPage wizard;
	private SWTBotShell botShell;
	private Shell shell;
	private Display display;
        private SWTBot bot;

	@Before
	public void setUp() {

		botShell = new SWTBotShell(shell);
		bot = new SWTBot();
		wizard = new ManualSettingsWizardPage();

		display = Display.getDefault();
		shell = new Shell(display);
		shell.open();
		shell.layout();

	}

	@Test
	public void bot() throws Exception {
		bot = botShell.bot();
		shell.setBounds(200, 200, 400, 400);
		shell.setLayout(new FillLayout());

		wizard.createControl(shell);
	}


Previous Topic:"Widget is disposed" when TreeColumnLayout is running
Next Topic:Do you want a recorder for SWTBot ?
Goto Forum:
  


Current Time: Tue Apr 23 13:50:59 GMT 2024

Powered by FUDForum. Page generated in 0.02665 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top