diff --git a/runtime/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllPerfTests.java b/runtime/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllPerfTests.java index 543f85252c6..a1800263b91 100644 --- a/runtime/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllPerfTests.java +++ b/runtime/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/perf/AllPerfTests.java @@ -13,14 +13,29 @@ *******************************************************************************/ package org.eclipse.core.tests.runtime.perf; -import junit.framework.*; import org.eclipse.core.tests.runtime.RuntimeTestsPlugin; -import org.eclipse.core.tests.session.*; +import org.eclipse.core.tests.session.PerformanceSessionTestSuite; +import org.eclipse.core.tests.session.Setup; import org.eclipse.core.tests.session.SetupManager.SetupException; +import org.eclipse.core.tests.session.UIPerformanceSessionTestSuite; +import org.junit.jupiter.api.DynamicTest; +import org.junit.jupiter.api.TestFactory; +import org.junit.platform.suite.api.SelectClasses; +import org.junit.platform.suite.api.Suite; -public class AllPerfTests extends TestCase { - public static Test suite() { - TestSuite suite = new TestSuite(AllPerfTests.class.getName()); +import java.util.ArrayList; +import java.util.List; + +@Suite +@SelectClasses({ // + BenchPath.class, // + PreferencePerformanceTest.class, // +}) +public class AllPerfTests { + + @TestFactory + List createPerformanceTests() { + List tests = new ArrayList<>(); // make sure that the first run of the startup test is not recorded - it is heavily // influenced by the presence and validity of the cached information @@ -28,9 +43,14 @@ public static Test suite() { PerformanceSessionTestSuite firstRun = new PerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 1, StartupTest.class); Setup setup = firstRun.getSetup(); setup.setSystemProperty("eclipseTest.ReportResults", "false"); - suite.addTest(firstRun); + tests.add(DynamicTest.dynamicTest("Warm-up StartupTest", () -> { + // Execute the warm-up test + firstRun.run(null); + })); } catch (SetupException e) { - fail("Unable to create warm up test"); + tests.add(DynamicTest.dynamicTest("Warm-up test setup failed", () -> { + throw new RuntimeException("Unable to create warm up test", e); + })); } // For this test to take advantage of the new runtime processing, we set "-eclipse.activateRuntimePlugins=false" @@ -38,15 +58,28 @@ public static Test suite() { PerformanceSessionTestSuite headlessSuite = new PerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 5, StartupTest.class); Setup headlessSetup = headlessSuite.getSetup(); headlessSetup.setSystemProperty("eclipse.activateRuntimePlugins", "false"); - suite.addTest(headlessSuite); + tests.add(DynamicTest.dynamicTest("Headless StartupTest", () -> { + // Execute the headless performance test + headlessSuite.run(null); + })); } catch (SetupException e) { - fail("Unable to setup headless startup performance test"); + tests.add(DynamicTest.dynamicTest("Headless test setup failed", () -> { + throw new RuntimeException("Unable to setup headless startup performance test", e); + })); } - suite.addTest(new UIPerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 5, UIStartupTest.class)); - suite.addTestSuite(BenchPath.class); - suite.addTest(ContentTypePerformanceTest.suite()); - suite.addTestSuite(PreferencePerformanceTest.class); - return suite; + // UI startup performance test + UIPerformanceSessionTestSuite uiSuite = new UIPerformanceSessionTestSuite(RuntimeTestsPlugin.PI_RUNTIME_TESTS, 5, UIStartupTest.class); + tests.add(DynamicTest.dynamicTest("UI StartupTest", () -> { + // Execute the UI performance test + uiSuite.run(null); + })); + + // Content type performance tests (handled via dynamic test to preserve complex suite behavior) + tests.add(DynamicTest.dynamicTest("ContentType Performance Tests", () -> { + ContentTypePerformanceTest.suite().run(null); + })); + + return tests; } }