Open vogella opened 6 years ago
You need to be more specific. why would you run an UI JUnit-Test who requires SWT. I think you want to run a core test. So you need to run the [No application] - Headless Mode on the Main-Tab
and no never add the Platform-SDK if you want to develop a e4-RCP on JavaFX - stupid PDE will add stuff to your launch configuration (because it is feature-based) who will fail miserably
The target would be to have a test which starts the Fx application so that this test can be used to ensure that the application can be started. Once this works, tests could check if the application works fine, e.g., use the ModelService to ensure all parts can be opened, etc.
Therefore a headless test is not useful.
As this bug was already closed, shall I open a new ticket?
Feel free to reopen - and modify your request to eg ask that you get something similar to upstream PDE has for SWT (not sure although we'll ever implement this because PDE is not the future for e(fx)clipse) but maybe someone wants to provide a PR
Reopen is not enabled for me.
If PDE is not the way to start a test for e4 FX application, what is the recommended way? I looked through the repositories but was unable to find a test which starts the whole application and executes a test within the e4 fx application.
Note the term "future" ;-) The future for e4 FX is pure maven - with any IDE you want - we won't break PDE support - so what is there is there but new stuff like the one you requested is something that has to be contributed from the outside
I don't mind running e4 fx tests via Maven but this also seems not to work, at least not for me. Can you point me to a working e4 fx maven test for the whole application? I also search the repo(s) for such a test and was not able to find one.
Once more "Future" is the keyword.
I did not say we are fully there yet so it - you can subscribe to https://github.com/BestSolution-at/maven-osgi-plugin/issues/15 and once it is resolved you will be able run the applications without PDE.
Thanks, Tom for a confirmation that running e4 fx tests for the application is currently not supported. I adjusted the title of this bug report so others will be able to find this information easier.
Now after having discussed this - i think you can already do that - we did this as part of our FX-Test framework - see https://github.com/BestSolution-at/FX-Test and more specifically - https://github.com/BestSolution-at/FX-Test/blob/master/e4-test/sample.osgi.app.app.junit/src/sample/osgi/app/app/junit/ApplicationTest.java
You run that as a headless-test but it will launch your e4 application
Thanks @tomsontom I have a look and let you know if that works for me.
@tomsontom @vogella today I've adopted the application test example from here: https://github.com/BestSolution-at/efxclipse-sample-mvvm/tree/master/sample.mvvm.ui.tests
And it works like a charm.
@tomsontom Do you have any concerns about this approach from the 2 year old example?
I can remember that we had constant raise conditions - we use our own fx test lib now instead - source is now completely at Eclipse.org but API still in the flux - put positive you can shape the future API :-)
Anyways if it works for you then go for it
I would like to start a test within the context of an e4 RCP application with JavaFx. For this test, I created a minimal e4 RCP application using the fx wizard and added only a window. Therefore, I select the product on the "Main" tab of the runtime configuration of the Test case.
The test itself is a very simple example:
Now if I start the test, I receive:
!SESSION 2018-11-06 13:38:11.557 ----------------------------------------------- eclipse.buildId=unknown java.version=1.8.0_191 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE Framework arguments: -version 3 -port 53768 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames app.tests.TestCase -application org.eclipse.pde.junit.runtime.uitestapplication -product app.app.product -testpluginname app.tests Command-line arguments: -os win32 -ws win32 -arch x86_64 -consoleLog -version 3 -port 53768 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames app.tests.TestCase -application org.eclipse.pde.junit.runtime.uitestapplication -product app.app.product -data C:\Users\ex0227\workspace\efxclipse/../junit-workspace -dev file:C:/Users/ex0227/workspace/efxclipse/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -testpluginname app.tests
!ENTRY org.eclipse.osgi 4 0 2018-11-06 13:38:13.140 !MESSAGE Application error !STACK 1 java.lang.NoClassDefFoundError: org/eclipse/ui/PlatformUI at org.eclipse.pde.internal.junit.runtime.UITestApplication.runApp(UITestApplication.java:41) at org.eclipse.pde.internal.junit.runtime.NonUIThreadTestApplication.start(NonUIThreadTestApplication.java:49) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) at org.eclipse.equinox.launcher.Main.run(Main.java:1499) at org.eclipse.equinox.launcher.Main.main(Main.java:1472) Caused by: java.lang.ClassNotFoundException: org.eclipse.ui.PlatformUI cannot be found by org.eclipse.pde.junit.runtime_3.5.300.v20180827-1331 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:484) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 15 more An error has occurred. See the log file C:\Users\ex0227\workspace\efxclipse.metadata.plugins\org.eclipse.pde.core\pde-junit\1541507891711.log.
I assumed that this may require adding the Eclipse platform SDK to the target platform but even after this change, I receive the same error message.