Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Wagiaalla2013-04-05 18:19:48 +0000
committerCamilo Bernal2013-04-09 14:59:03 +0000
commit8f5e243bd9bcb29c16401053888c864de215cfb8 (patch)
treee009e88802fb8ea0b30299e85f25080e2f3963b6 /systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java
parent44606ab5341d74126961e4d0d862f8f8dd7f48d8 (diff)
downloadorg.eclipse.linuxtools-8f5e243bd9bcb29c16401053888c864de215cfb8.tar.gz
org.eclipse.linuxtools-8f5e243bd9bcb29c16401053888c864de215cfb8.tar.xz
org.eclipse.linuxtools-8f5e243bd9bcb29c16401053888c864de215cfb8.zip
Add SWTBot test for creating a new Systemtap script
Change-Id: I5f2bc84074ceb0390766e5cb56cb1f478c0dfe6d Reviewed-on: https://git.eclipse.org/r/11691 Tested-by: Hudson CI Reviewed-by: Camilo Bernal <cabernal@redhat.com> IP-Clean: Camilo Bernal <cabernal@redhat.com> Tested-by: Camilo Bernal <cabernal@redhat.com>
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java')
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java100
1 files changed, 100 insertions, 0 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java
new file mode 100644
index 0000000000..efe24172ed
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/swtbot/TestCreateSystemtapScript.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Red Hat.
+ * 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:
+ * Red Hat - initial implementation
+ *******************************************************************************/
+
+
+package org.eclipse.linuxtools.systemtap.ui.ide.test.swtbot;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class TestCreateSystemtapScript {
+
+ static SWTWorkbenchBot bot;
+
+ private static final String SYSTEMTAP_PROJECT_NAME = "SystemtapTest";
+
+ @BeforeClass
+ public static void beforeClass() {
+ bot = new SWTWorkbenchBot();
+
+ try {
+ bot.viewByTitle("Welcome").close();
+ // hide Subclipse Usage stats popup if present/installed
+ bot.shell("Subclipse Usage").activate();
+ bot.button("Cancel").click();
+ } catch (WidgetNotFoundException e) {
+ //ignore
+ }
+
+ // Create a Systemtap project.
+ SWTBotMenu fileMenu = bot.menu("File");
+ SWTBotMenu newMenu = fileMenu.menu("New");
+ SWTBotMenu projectMenu = newMenu.menu("Project...");
+ projectMenu.click();
+
+ for (int i = 0; i < bot.shells().length; i++) {
+ System.out
+ .println("TestCreateSystemtapScript.beforeClass() "
+ + bot.shells()[i]);
+ }
+ SWTBotShell shell = bot.shell("New Project");
+ shell.activate();
+
+ bot.tree().expandNode("General").select("Project");
+
+ bot.button("Next >").click();
+
+ bot.textWithLabel("Project name:").setText(SYSTEMTAP_PROJECT_NAME);
+ bot.button("Finish").click();
+ while (shell.isOpen()){
+ System.out
+ .println("TestCreateSystemtapScript.beforeClass() shell "
+ + shell);
+ bot.sleep(1000);
+ }
+ }
+
+ public static void createScript(SWTWorkbenchBot bot, String scriptName) {
+
+ SWTBotMenu fileMenu = bot.menu("File");
+ SWTBotMenu newMenu = fileMenu.menu("New");
+ SWTBotMenu projectMenu = newMenu.menu("Other...");
+ projectMenu.click();
+
+ SWTBotShell shell = bot.shell("New");
+ shell.activate();
+
+ bot.tree().expandNode("Systemtap").select("Systemtap Script");
+ bot.button("Next >").click();
+
+ bot.textWithLabel("Script Name:").setText(scriptName);
+ bot.button("Browse").click();
+
+ bot.tree().select(SYSTEMTAP_PROJECT_NAME);
+ bot.button("OK").click();
+
+ bot.button("Finish").click();
+
+ assert(bot.activeEditor().getTitle().equals(scriptName));
+ }
+
+ @Test
+ public void testCreateScript(){
+ createScript(bot, "testScript.stp");
+ }
+} \ No newline at end of file

Back to the top