diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/AbstractTest.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/AbstractTest.java index c4e660eb984..d834f431a03 100644 --- a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/AbstractTest.java +++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/AbstractTest.java @@ -25,6 +25,7 @@ import org.eclipse.core.resources.IProjectNature; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.bindings.keys.ParseException; import org.eclipse.swt.SWT; @@ -52,20 +53,34 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; import org.hamcrest.Matcher; import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; public abstract class AbstractTest { + + private static final String PROJECT_NAME = "GnuProject"; + protected static SWTWorkbenchBot bot; protected static String projectName; protected static SWTBotShell mainShell; protected static SWTBotView projectExplorer; + @BeforeClass + public static void initAbstractClass() throws Exception { + AbstractTest.init(PROJECT_NAME); + } + + @AfterClass + public static void afterClass() throws Exception { + AbstractTest.deleteProject(PROJECT_NAME); + } + public static void init(String projectName) throws Exception { SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; SWTBotPreferences.PLAYBACK_DELAY = 10; bot = new SWTWorkbenchBot(); bot.sleep(5000); mainShell = getMainShell(); - // Close the Welcome view if it exists try { bot.viewByTitle("Welcome").close(); @@ -115,6 +130,10 @@ public abstract class AbstractTest { projectExplorer = bot.viewByTitle("Project Explorer"); } + public static void deleteProject(String projectName) throws CoreException { + ResourcesPlugin.getWorkspace().getRoot().getProject(projectName).delete(true, null); + } + public static class NodeAvailableAndSelect extends DefaultCondition { private SWTBotTree tree; diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/SetConfigurationParameter.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/SetConfigurationParameter.java index 000bacf8451..3b8d618cba1 100644 --- a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/SetConfigurationParameter.java +++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/SetConfigurationParameter.java @@ -22,7 +22,6 @@ import java.util.regex.Pattern; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import org.eclipse.cdt.autotools.ui.tests.AbstractTest.NodeAvailableAndSelect; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.IWorkspaceRoot; @@ -50,8 +49,7 @@ import org.w3c.dom.NodeList; public class SetConfigurationParameter extends AbstractTest { @BeforeClass - public static void beforeClass() throws Exception { - AbstractTest.init("GnuProject0"); + public static void initClass() throws Exception { initConfigParm(); } diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestEnvironmentVars.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestEnvironmentVars.java index fc881d5da7b..1e9ca4d01d6 100644 --- a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestEnvironmentVars.java +++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestEnvironmentVars.java @@ -24,7 +24,6 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.waits.Conditions; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; -import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,11 +33,6 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestEnvironmentVars extends AbstractTest { - @BeforeClass - public static void beforeClass() throws Exception { - AbstractTest.init("GnuProject2"); - } - // Verify we can pass an unknown env var in configure options and it will be // nulled out // Verifies fix for Bug: #303616 diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java index 892af6c115e..5ec9b9c1413 100644 --- a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java +++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestMakeTargets.java @@ -25,7 +25,6 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.waits.Conditions; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; -import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; @@ -35,11 +34,6 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestMakeTargets extends AbstractTest { - @BeforeClass - public static void beforeClass() throws Exception { - AbstractTest.init("GnuProject3"); - } - @Test // Verify we can build and run the info MakeTarget tool public void t1canBuildAndAccessInfoTarget() throws Exception { diff --git a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java index 7e4cb49e981..1d0a5a7b2e6 100644 --- a/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java +++ b/build/org.eclipse.cdt.autotools.ui.tests/src/org/eclipse/cdt/autotools/ui/tests/TestToolActions.java @@ -20,7 +20,6 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; -import org.junit.BeforeClass; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,11 +29,6 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestToolActions extends AbstractTest { - @BeforeClass - public static void beforeClass() throws Exception { - AbstractTest.init("GnuProject4"); - } - @Test // Verify we can set the tools via the Autotools Tools page public void t1canSeeTools() throws Exception {