Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,73 @@
*******************************************************************************/
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<DynamicTest> createPerformanceTests() {
List<DynamicTest> 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
try {
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"
try {
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;
}
}
Loading