Running JUnit Plugin Tests on Gerrit

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Running JUnit Plugin Tests on Gerrit

Becker, Matthias
Hi everybody,

in https://git.eclipse.org/r/#/c/131114/ I created a Junit Plugin Test for a preference page.
When I execute this test inside the Eclipse IDE as “Junit Plugin Test” this test is running fine.
But when running on Gerrit the test fails with the message: “Workbench has not been created yet.”
See: https://ci.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/16155/testReport/junit/org.eclipse.ui.internal.ide.application.dialogs/UriSchemeHandlerPreferencePageTest/testSchemesShown/ 

What am I doing wrong? Can you give me a hint what I need to do to fix that?

Regards,
Matthias

_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|

Re: Running JUnit Plugin Tests on Gerrit

Mickael Istria-5
Hi,

In the build log you can see
[INFO] --- tycho-surefire-plugin:1.3.0-SNAPSHOT:test (default-test) @ org.eclipse.ui.ide.application.tests ---
...
application, org.eclipse.tycho.surefire.osgibooter.headlesstest
...

Which shows that the application run to test this plugin is headless (no workbench).
If you need UI for your test, you need to tweak the configuration of Maven surefire plugin so the workbench is created: https://www.eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html#useUIHarness

HTH



_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev
Reply | Threaded
Open this post in threaded view
|

Re: Running JUnit Plugin Tests on Gerrit

Becker, Matthias

Thank you Mickael for that hint.

I changed the pom.xml see: https://git.eclipse.org/r/#/c/131114/3/tests/org.eclipse.ui.ide.application.tests/pom.xml

 

The build log now says:

09:44:08 [INFO] --- tycho-surefire-plugin:1.3.0-SNAPSHOT:test (default-test) @ org.eclipse.ui.ide.application.tests ---

-application, org.eclipse.tycho.surefire.osgibooter.uitest

 

But my test gets a NPE when doing

Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

 

And now even IDEWorkbenchAdvisorTest fails.

 

What’s wrong?

 

Regards,

Matthias

 

From: <[hidden email]> on behalf of Mickael Istria <[hidden email]>
Reply-To: "Eclipse Platform UI component developers list." <[hidden email]>
Date: Thursday, 18. October 2018 at 16:44
To: "Eclipse Platform UI component developers list." <[hidden email]>
Subject: Re: [platform-ui-dev] Running JUnit Plugin Tests on Gerrit

 

Hi,

 

In the build log you can see

[INFO] --- tycho-surefire-plugin:1.3.0-SNAPSHOT:test (default-test) @ org.eclipse.ui.ide.application.tests ---
...
application, org.eclipse.tycho.surefire.osgibooter.headlesstest
...
Which shows that the application run to test this plugin is headless (no workbench).
If you need UI for your test, you need to tweak the configuration of Maven surefire plugin so the workbench is created: https://www.eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html#useUIHarness
HTH

 

 


_______________________________________________
platform-ui-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/platform-ui-dev