Skip to content

Commit 085f934

Browse files
committed
Simplify tagging of UI performance tests
UI performance tests use the existing tagging capabilities very rarely. This removes the tagging calls where it does not have any effect anymore and in the remaining cases simplifies the tagging specification such that no utility functions in the common BasicPerformanceTest superclass is necessary anymore. In addition, useless checks inside the BasicPerformanceTest constructor are removed, as they were only necessary for interactive execution mode that has already been removed.
1 parent d0e2112 commit 085f934

15 files changed

+26
-129
lines changed

tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ListViewerRefreshTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import org.eclipse.jface.viewers.ListViewer;
2020
import org.eclipse.jface.viewers.StructuredViewer;
2121
import org.eclipse.swt.widgets.Shell;
22-
import org.eclipse.test.performance.Dimension;
2322
import org.junit.Test;
2423

2524
/**
@@ -46,10 +45,6 @@ protected StructuredViewer createViewer(Shell shell) {
4645
*/
4746
@Test
4847
public void testRefresh() throws Throwable {
49-
50-
tagIfNecessary("JFace - Refresh 100 item ListViewer 10 times",
51-
Dimension.ELAPSED_PROCESS);
52-
5348
openBrowser();
5449

5550
exercise(() -> {

tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ProgressMonitorDialogPerformanceTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.eclipse.jface.operation.IRunnableWithProgress;
2121
import org.eclipse.swt.widgets.Display;
2222
import org.eclipse.swt.widgets.Shell;
23-
import org.eclipse.test.performance.Dimension;
2423
import org.eclipse.ui.tests.performance.BasicPerformanceTest;
2524
import org.eclipse.ui.tests.performance.UIPerformanceTestRule;
2625
import org.junit.ClassRule;
@@ -39,10 +38,6 @@ public class ProgressMonitorDialogPerformanceTest extends BasicPerformanceTest {
3938
*/
4039
@Test
4140
public void testLongNames() throws Throwable {
42-
43-
tagIfNecessary("JFace - 10000 element task name in progress dialog",
44-
Dimension.ELAPSED_PROCESS);
45-
4641
Display display = Display.getCurrent();
4742
if (display == null) {
4843
display = new Display();

tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ShrinkingTreeTest.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import static org.eclipse.ui.tests.harness.util.UITestUtil.processEvents;
1717

1818
import org.eclipse.core.runtime.CoreException;
19-
import org.eclipse.test.performance.Dimension;
2019
import org.junit.Test;
2120

2221
/**
@@ -28,10 +27,6 @@ public class ShrinkingTreeTest extends TreeTest {
2827

2928
@Test
3029
public void testTreeViewerRefresh() throws CoreException {
31-
32-
tagIfNecessary("JFace - Refresh from 1000 items to 100 items",
33-
Dimension.ELAPSED_PROCESS);
34-
3530
openBrowser();
3631
// int smallCount = 1;
3732
// for (int i = 0; i < 3; i++) {

tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/TreeAddTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ public void testAddFifty() throws CoreException {
7373
*/
7474
@Test
7575
public void testAddHundred() throws CoreException {
76-
77-
tagIfNecessary("JFace - Add 1000 items in 10 blocks to TreeViewer",
78-
Dimension.ELAPSED_PROCESS);
79-
8076
doTestAdd(100, TEST_COUNT, false);
8177
}
8278

tests/org.eclipse.ui.tests.performance/src/org/eclipse/jface/tests/performance/ViewerTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ public abstract class ViewerTest extends BasicPerformanceTest {
3939
public static int ITERATIONS = 100;
4040
public static int MIN_ITERATIONS = 20;
4141

42-
public ViewerTest(int tagging) {
43-
super(tagging);
44-
}
45-
46-
public ViewerTest() {
47-
super();
48-
}
49-
5042
protected void openBrowser() {
5143
Display display = Display.getCurrent();
5244
if (display == null) {

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/BasicPerformanceTest.java

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@
2020
import org.eclipse.core.runtime.Status;
2121
import org.eclipse.core.runtime.jobs.Job;
2222
import org.eclipse.swt.widgets.Display;
23-
import org.eclipse.test.performance.Dimension;
2423
import org.eclipse.test.performance.PerformanceTestCaseJunit4;
2524
import org.eclipse.ui.PlatformUI;
2625
import org.eclipse.ui.tests.harness.util.CloseTestWindowsRule;
2726
import org.junit.Rule;
2827
import org.junit.function.ThrowingRunnable;
29-
import org.osgi.framework.Bundle;
30-
import org.osgi.framework.BundleContext;
3128
import org.osgi.framework.FrameworkUtil;
3229

3330
/**
@@ -37,61 +34,9 @@
3734
*/
3835
public abstract class BasicPerformanceTest extends PerformanceTestCaseJunit4 {
3936

40-
public static final int NONE = 0;
41-
42-
public static final int LOCAL = 1;
43-
44-
public static final int GLOBAL = 2;
45-
4637
@Rule
4738
public final CloseTestWindowsRule closeTestWindows = new CloseTestWindowsRule();
4839

49-
final private boolean tagAsGlobalSummary;
50-
51-
final private boolean tagAsSummary;
52-
53-
public BasicPerformanceTest() {
54-
this(NONE);
55-
Bundle bundle = FrameworkUtil.getBundle(getClass());
56-
BundleContext context = bundle != null ? bundle.getBundleContext() : null;
57-
if (context == null) { // most likely run in a wrong launch mode
58-
System.err.println("Unable to retrieve bundle context from BasicPerformanceTest; interactive mode is disabled");
59-
return;
60-
}
61-
}
62-
63-
public BasicPerformanceTest(int tagging) {
64-
tagAsGlobalSummary = ((tagging & GLOBAL) != 0);
65-
tagAsSummary = ((tagging & LOCAL) != 0);
66-
}
67-
68-
/**
69-
* Answers whether this test should be tagged globally.
70-
*
71-
* @return whether this test should be tagged globally
72-
*/
73-
private boolean shouldGloballyTag() {
74-
return tagAsGlobalSummary;
75-
}
76-
77-
/**
78-
* Answers whether this test should be tagged locally.
79-
*
80-
* @return whether this test should be tagged locally
81-
*/
82-
private boolean shouldLocallyTag() {
83-
return tagAsSummary;
84-
}
85-
86-
public void tagIfNecessary(String shortName, Dimension dimension) {
87-
if (shouldGloballyTag()) {
88-
tagAsGlobalSummary(shortName, dimension);
89-
}
90-
if (shouldLocallyTag()) {
91-
tagAsSummary(shortName, dimension);
92-
}
93-
}
94-
9540
public static void waitForBackgroundJobs() {
9641

9742
Job backgroundJob = new Job(

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseEditorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@ public class OpenCloseEditorTest extends BasicPerformanceTest {
4545

4646
@Parameters(name = "{index}: {0}")
4747
public static Collection<Object[]> data() {
48-
return Arrays.asList(new Object[][] { { "perf_basic", BasicPerformanceTest.NONE },
49-
{ "perf_outline", BasicPerformanceTest.NONE }, { "java", BasicPerformanceTest.LOCAL } });
48+
return Arrays.asList(new Object[][] { { "perf_basic" }, { "perf_outline" }, { "java" } });
5049
}
5150

5251

53-
public OpenCloseEditorTest(String extension, int tagging) {
54-
super(tagging);
52+
public OpenCloseEditorTest(String extension) {
5553
this.extension = extension;
5654
}
5755

@@ -80,7 +78,9 @@ public void test() throws Throwable {
8078
stopMeasuring();
8179
});
8280

83-
tagIfNecessary("UI - Open/Close Editor", Dimension.ELAPSED_PROCESS);
81+
if (extension.equals("java")) {
82+
tagAsSummary("UI - Open/Close Editor", Dimension.ELAPSED_PROCESS);
83+
}
8484
commitMeasurements();
8585
assertPerformance();
8686
}

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenClosePerspectiveTest.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,12 @@ public class OpenClosePerspectiveTest extends BasicPerformanceTest {
5656

5757
@Parameters(name = "{index}: {0}")
5858
public static Collection<Object[]> data() {
59-
return Arrays.asList(new Object[][] { { EmptyPerspective.PERSP_ID2, BasicPerformanceTest.NONE }, {
60-
UIPerformanceTestRule.PERSPECTIVE1,
61-
BasicPerformanceTest.LOCAL },
62-
{ "org.eclipse.ui.resourcePerspective", BasicPerformanceTest.NONE },
63-
{ "org.eclipse.jdt.ui.JavaPerspective", BasicPerformanceTest.NONE },
64-
{ "org.eclipse.debug.ui.DebugPerspective", BasicPerformanceTest.NONE } });
59+
return Arrays.asList(new Object[][] { { EmptyPerspective.PERSP_ID2 }, { UIPerformanceTestRule.PERSPECTIVE1 },
60+
{ "org.eclipse.ui.resourcePerspective" }, { "org.eclipse.jdt.ui.JavaPerspective" },
61+
{ "org.eclipse.debug.ui.DebugPerspective" } });
6562
}
6663

67-
public OpenClosePerspectiveTest(String id, int tagging) {
68-
super(tagging);
64+
public OpenClosePerspectiveTest(String id) {
6965
this.id = id;
7066
}
7167

@@ -103,7 +99,9 @@ public void test() throws Throwable {
10399
activePage.showView(i);
104100
}
105101

106-
tagIfNecessary("UI - Open/Close " + perspective1.getLabel() + " Perspective", Dimension.ELAPSED_PROCESS);
102+
if (id.equals(UIPerformanceTestRule.PERSPECTIVE1)) {
103+
tagAsSummary("UI - Open/Close " + perspective1.getLabel() + " Perspective", Dimension.ELAPSED_PROCESS);
104+
}
107105

108106
exercise(() -> {
109107
processEvents();

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseViewTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,12 @@ public class OpenCloseViewTest extends BasicPerformanceTest {
4242

4343
@Parameters(name = "{index}: {0}")
4444
public static Collection<Object[]> data() {
45-
return ViewPerformanceUtil.getAllTestableViewIds().stream().map(
46-
id -> new Object[] { id, id.equals(ViewPerformanceUtil.PROJECT_EXPLORER) ? BasicPerformanceTest.GLOBAL
47-
: BasicPerformanceTest.NONE })
48-
.toList();
45+
return ViewPerformanceUtil.getAllTestableViewIds().stream().map(id -> new Object[] { id }).toList();
4946
}
5047

5148
private final String viewId;
5249

53-
public OpenCloseViewTest(String viewId, int tagging) {
54-
super(tagging);
50+
public OpenCloseViewTest(String viewId) {
5551
this.viewId = viewId;
5652
}
5753

@@ -66,7 +62,9 @@ public void test() throws Throwable {
6662
waitForBackgroundJobs();
6763
processEvents();
6864

69-
tagIfNecessary("UI - Open/Close " + view1.getTitle(), Dimension.ELAPSED_PROCESS);
65+
if (viewId.equals(ViewPerformanceUtil.PROJECT_EXPLORER)) {
66+
tagAsGlobalSummary("UI - Open/Close " + view1.getTitle(), Dimension.ELAPSED_PROCESS);
67+
}
7068

7169
for (int j = 0; j < 100; j++) {
7270

tests/org.eclipse.ui.tests.performance/src/org/eclipse/ui/tests/performance/OpenCloseWindowTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Arrays;
2121
import java.util.Collection;
2222

23-
import org.eclipse.test.performance.Dimension;
2423
import org.eclipse.ui.IWorkbenchWindow;
2524
import org.eclipse.ui.tests.harness.util.EmptyPerspective;
2625
import org.junit.ClassRule;
@@ -45,14 +44,11 @@ public static Collection<Object[]> data() {
4544
}
4645

4746
public OpenCloseWindowTest(String id) {
48-
super(BasicPerformanceTest.NONE);
4947
this.id = id;
5048
}
5149

5250
@Test
5351
public void test() throws Throwable {
54-
tagIfNecessary("UI - Open/Close Window", Dimension.ELAPSED_PROCESS);
55-
5652
exercise(() -> {
5753
processEvents();
5854
EditorTestHelper.calmDown(500, 30000, 500);

0 commit comments

Comments
 (0)