Note that there are some explanatory texts on larger screens.

plurals
  1. POJava - SWTBot test wizard without workbench
    text
    copied!<p>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.</p> <p>So i created a new shell class which included this code:</p> <pre><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); } </code></pre> <p>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:</p> <pre><code>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); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload