Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCurtis D'Entremont2006-11-22 17:15:27 +0000
committerCurtis D'Entremont2006-11-22 17:15:27 +0000
commitc1b1f4c4d6190570987ba7566aa177fce589c57a (patch)
tree871d3e906b656ac71fc15a354ecb69f00487dbf3 /org.eclipse.ua.tests/intro/org
parentfb6c264f3e9419d4780635b4f0004596699db52e (diff)
downloadeclipse.platform.ua-c1b1f4c4d6190570987ba7566aa177fce589c57a.tar.gz
eclipse.platform.ua-c1b1f4c4d6190570987ba7566aa177fce589c57a.tar.xz
eclipse.platform.ua-c1b1f4c4d6190570987ba7566aa177fce589c57a.zip
added UA performance tests
Diffstat (limited to 'org.eclipse.ua.tests/intro/org')
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/AllIntroPerformanceTests.java34
-rw-r--r--org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java75
2 files changed, 109 insertions, 0 deletions
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/AllIntroPerformanceTests.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/AllIntroPerformanceTests.java
new file mode 100644
index 000000000..d0b42064c
--- /dev/null
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/AllIntroPerformanceTests.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ua.tests.intro.performance;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/*
+ * Tests help performance (automated).
+ */
+public class AllIntroPerformanceTests extends TestSuite {
+
+ /*
+ * Returns the entire test suite.
+ */
+ public static Test suite() {
+ return new AllIntroPerformanceTests();
+ }
+
+ /*
+ * Constructs a new performance test suite.
+ */
+ public AllIntroPerformanceTests() {
+ addTest(OpenIntroTest.suite());
+ }
+}
diff --git a/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java
new file mode 100644
index 000000000..d9c2f1a72
--- /dev/null
+++ b/org.eclipse.ua.tests/intro/org/eclipse/ua/tests/intro/performance/OpenIntroTest.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.ua.tests.intro.performance;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.test.performance.Dimension;
+import org.eclipse.test.performance.PerformanceTestCase;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.intro.IIntroManager;
+import org.eclipse.ui.intro.IIntroPart;
+
+public class OpenIntroTest extends PerformanceTestCase {
+
+ /*
+ * Returns an instance of this Test.
+ */
+ public static Test suite() {
+ return new TestSuite(OpenIntroTest.class);
+ }
+
+ public void testOpenIntro() throws Exception {
+ tagAsSummary("Open welcome", Dimension.ELAPSED_PROCESS);
+
+ // warm-up
+ for (int i=0;i<3;++i) {
+ closeIntro();
+ openIntro();
+ }
+
+ // run the tests
+ for (int i=0;i<20;++i) {
+ closeIntro();
+ startMeasuring();
+ openIntro();
+ stopMeasuring();
+ }
+
+ commitMeasurements();
+ assertPerformance();
+ }
+
+ public static void closeIntro() throws Exception {
+ IIntroManager manager = PlatformUI.getWorkbench().getIntroManager();
+ IIntroPart part = manager.getIntro();
+ if (part != null) {
+ manager.closeIntro(part);
+ }
+ flush();
+ }
+
+ private static void openIntro() throws Exception {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IIntroManager manager = workbench.getIntroManager();
+ manager.showIntro(workbench.getActiveWorkbenchWindow(), false);
+ flush();
+ }
+
+ private static void flush() {
+ Display display = Display.getCurrent();
+ while (display.readAndDispatch()) {
+ }
+ }
+}

Back to the top