From eaa475b4f6768a7b6e603c802f2d0472ae10a553 Mon Sep 17 00:00:00 2001 From: Luise Ravnskjaer <13628062+ravnskjaer@users.noreply.github.com> Date: Sat, 5 Dec 2026 13:18:06 +0100 Subject: [PATCH 1/2] Fix empty view list in ViewPerformanceUtil.getAllTestableViewIds() In the e4 compatibility layer, IViewDescriptor.getCategoryPath() contains the category label ("General") instead of the category id ("org.eclipse.ui"), so no view ever matched and the view cases of OpenCloseViewTest and ResizeTest did not run. Select the views via IViewRegistry.getCategories() by category id instead, and return them sorted so that the test order is deterministic. Part of #3639 --- .../performance/ViewPerformanceUtil.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ViewPerformanceUtil.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ViewPerformanceUtil.java index ebf55335f27..5da8878eb2d 100644 --- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ViewPerformanceUtil.java +++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/ViewPerformanceUtil.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2017 IBM Corporation and others. + * Copyright (c) 2004, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -15,9 +15,11 @@ package org.eclipse.ui.tests.performance; import java.util.Collection; -import java.util.HashSet; +import java.util.Set; +import java.util.TreeSet; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.views.IViewCategory; import org.eclipse.ui.views.IViewDescriptor; /** @@ -27,7 +29,7 @@ public final class ViewPerformanceUtil { public static final String PROJECT_EXPLORER = "org.eclipse.ui.navigator.ProjectExplorer"; - private static final String BASIC_PATH = "org.eclipse.ui"; + private static final String BASIC_CATEGORY = "org.eclipse.ui"; private static final String VIEWS_PATTERN = "org.eclipse.ui.views"; @@ -35,23 +37,20 @@ private ViewPerformanceUtil() { } public static Collection getAllTestableViewIds() { - HashSet result = new HashSet<>(); - - IViewDescriptor[] descriptors = PlatformUI.getWorkbench().getViewRegistry().getViews(); - for (IViewDescriptor descriptor : descriptors) { - String[] categoryPath = descriptor.getCategoryPath(); - if (categoryPath == null) + Set result = new TreeSet<>(); + // match by category id; in e4, getCategoryPath() contains the category label + for (IViewCategory category : PlatformUI.getWorkbench().getViewRegistry().getCategories()) { + // only test basic views + if (!BASIC_CATEGORY.equals(category.getId())) { continue; - for (String categoryPath1 : categoryPath) { - // Only test basic views - if (categoryPath1.equals(BASIC_PATH)) { - if (descriptor.getId().contains(VIEWS_PATTERN) || descriptor.getId().equals(PROJECT_EXPLORER)) { - result.add(descriptor.getId()); - } + } + for (IViewDescriptor descriptor : category.getViews()) { + String id = descriptor.getId(); + if (id.contains(VIEWS_PATTERN) || id.equals(PROJECT_EXPLORER)) { + result.add(id); } } } - return result; } } From c412216af15ca356a71160f6ee453642c30a2541 Mon Sep 17 00:00:00 2001 From: Luise Ravnskjaer <13628062+ravnskjaer@users.noreply.github.com> Date: Sat, 5 Dec 2026 14:24:12 +0100 Subject: [PATCH 2/2] Migrate OpenCloseViewTest to JUnit 5 * Use PerformanceTestCaseJunit5 instead of PerformanceTestCaseJunit4. * Use CloseTestWindowsExtension instead of CloseTestWindowsRule. * Use @ParameterizedTest instead of RunWith(Parameterized.class). * Update the outdated class Javadoc. Part of #3639 --- .../tests/performance/OpenCloseViewTest.java | 50 +++++++------------ 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseViewTest.java b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseViewTest.java index a66faaf0498..9f1d20e002c 100644 --- a/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseViewTest.java +++ b/tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseViewTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2011 IBM Corporation and others. + * Copyright (c) 2004, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -17,49 +17,37 @@ import static org.eclipse.ui.tests.harness.util.UITestUtil.processEvents; import static org.eclipse.ui.tests.performance.UIPerformanceTestUtil.waitForBackgroundJobs; -import java.util.Collection; +import java.util.stream.Stream; import org.eclipse.test.performance.Dimension; -import org.eclipse.test.performance.PerformanceTestCaseJunit4; +import org.eclipse.test.performance.PerformanceTestCaseJunit5; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; +import org.eclipse.ui.tests.harness.util.CloseTestWindowsExtension; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; /** - * Performance tests for showing views. - * There are separate tests for showing a simple view (MockViewPart) - * and a more complex view (Resource Navigator). - * The views are shown in an empty perspective. + * Performance tests for opening and closing the basic workbench views. The + * views are shown in an empty perspective. */ -@RunWith(Parameterized.class) -public class OpenCloseViewTest extends PerformanceTestCaseJunit4 { +class OpenCloseViewTest extends PerformanceTestCaseJunit5 { - @ClassRule - public static final UIPerformanceTestRule uiPerformanceTestRule = new UIPerformanceTestRule(); + @RegisterExtension + static UIPerformanceTestRule uiPerformanceTestRule = new UIPerformanceTestRule(); - @Rule - public final CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule(); + @RegisterExtension + CloseTestWindowsExtension closeTestWindows = new CloseTestWindowsExtension(); - @Parameters(name = "{index}: {0}") - public static Collection data() { - return ViewPerformanceUtil.getAllTestableViewIds().stream().map(id -> new Object[] { id }).toList(); + static Stream data() { + return ViewPerformanceUtil.getAllTestableViewIds().stream(); } - private final String viewId; - - public OpenCloseViewTest(String viewId) { - this.viewId = viewId; - } - - @Test - public void test() throws Throwable { + @ParameterizedTest(name = "{0}") + @MethodSource("data") + void test(String viewId) throws Throwable { IWorkbenchWindow window = openTestWindow(); final IWorkbenchPage page = window.getActivePage();