Community
Participate
Working Groups
The RCP UI tests currently run with all SDK plug-ins enabled. This leads to cases where there are more views, toolbar items, ... than there would be in a typical RCP app. For example, in the context of the automated tests, an "empty" RCP app always has some toolbar items coming from SDK plug-ins, and this makes it impossible to test cases where you need an empty tool bar. With help from Rafael, I managed to write a session test that runs with only the minimal set of RCP plug-ins. However, this starts an Eclipse instance for every test case. We would like to be able to run a whole suite of tests as one session test, but get the individual test results reported as if the suite had not been run as a session test.
Created attachment 25278 [details] patch for org.eclipse.core.tests.harness Adds support for running test suites in a single session. Usage: SessionTestSuite suite = new SessionTestSuite(<plug-in id>, <suite-class>); suite.setSharedSession(true); Restriction: this is the only form of creation supported, and crash tests (tests that are expected to crash the VM) are not supported.
The patch only works if the suite class given has a number of test... methods itself. I would like to use this for all our RCP tests, which means that the given suite class will have a suite() method that returns a suite of tests. If I run my suite, I'm getting a NPE at SessionTestRunner.java:111 which is printed on the console, then the tests seem to be executed, but in the end I get just one error: java.lang.Exception: Test did not run at org.eclipse.core.tests.session.SessionTestRunner.run (SessionTestRunner.java:295) at org.eclipse.core.tests.session.SessionTestSuite.run (SessionTestSuite.java:139) at org.eclipse.core.tests.session.ConfigurationSessionTestSuite.run (ConfigurationSessionTestSuite.java:174) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:478) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java:344) at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main (RemotePluginTestRunner.java:57) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run (CoreTestApplication.java:24) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.java:163) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948)
Created attachment 25314 [details] patch for org.eclipse.core.tests.harness I had made some wrong assumptions on how the junit.framework.TestSuite(Class) constructor works (it does not handle suite() methods). This new implementation requires the plug-in id constructor to be used (a Class should *not* be provided), and then the test suite (only one) that is to be run must be added as an additional step. This test suite can contain other suites. Example: SessionTestSuite suite = new SessionTestSuite("org.eclipse.ui.tests.rcp"); suite.addTest(new RcpTestSuite()); suite.setSharedSession(true); or: SessionTestSuite suite = new SessionTestSuite("my.plugin"); suite.addTestSuite(MyTestCase.class); suite.setSharedSession(true); Boris, could you give this a try? I will release this as soon we know we won't have any more i-builds this week.
Boris verified the fix works for him. Released to HEAD.
*** Bug 79506 has been marked as a duplicate of this bug. ***