mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
swtbot: Delete projects after tests
This allows running the tests repeatedly Change-Id: I289da60f0d3dc8d2539eeb5bc6f2b14e3bb35fb1 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/37752 Tested-by: Hudson CI
This commit is contained in:
parent
3ab1678bc3
commit
ae4ed4d438
5 changed files with 21 additions and 22 deletions
|
@ -25,6 +25,7 @@ import org.eclipse.core.resources.IProjectNature;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
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.KeyStroke;
|
||||||
import org.eclipse.jface.bindings.keys.ParseException;
|
import org.eclipse.jface.bindings.keys.ParseException;
|
||||||
import org.eclipse.swt.SWT;
|
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.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
|
||||||
public abstract class AbstractTest {
|
public abstract class AbstractTest {
|
||||||
|
|
||||||
|
private static final String PROJECT_NAME = "GnuProject";
|
||||||
|
|
||||||
protected static SWTWorkbenchBot bot;
|
protected static SWTWorkbenchBot bot;
|
||||||
protected static String projectName;
|
protected static String projectName;
|
||||||
protected static SWTBotShell mainShell;
|
protected static SWTBotShell mainShell;
|
||||||
protected static SWTBotView projectExplorer;
|
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 {
|
public static void init(String projectName) throws Exception {
|
||||||
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
|
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
|
||||||
SWTBotPreferences.PLAYBACK_DELAY = 10;
|
SWTBotPreferences.PLAYBACK_DELAY = 10;
|
||||||
bot = new SWTWorkbenchBot();
|
bot = new SWTWorkbenchBot();
|
||||||
bot.sleep(5000);
|
bot.sleep(5000);
|
||||||
mainShell = getMainShell();
|
mainShell = getMainShell();
|
||||||
|
|
||||||
// Close the Welcome view if it exists
|
// Close the Welcome view if it exists
|
||||||
try {
|
try {
|
||||||
bot.viewByTitle("Welcome").close();
|
bot.viewByTitle("Welcome").close();
|
||||||
|
@ -115,6 +130,10 @@ public abstract class AbstractTest {
|
||||||
projectExplorer = bot.viewByTitle("Project Explorer");
|
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 {
|
public static class NodeAvailableAndSelect extends DefaultCondition {
|
||||||
|
|
||||||
private SWTBotTree tree;
|
private SWTBotTree tree;
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.regex.Pattern;
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
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.IProject;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
|
@ -50,8 +49,7 @@ import org.w3c.dom.NodeList;
|
||||||
public class SetConfigurationParameter extends AbstractTest {
|
public class SetConfigurationParameter extends AbstractTest {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void beforeClass() throws Exception {
|
public static void initClass() throws Exception {
|
||||||
AbstractTest.init("GnuProject0");
|
|
||||||
initConfigParm();
|
initConfigParm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.waits.Conditions;
|
||||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -34,11 +33,6 @@ import org.junit.runners.MethodSorters;
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class TestEnvironmentVars extends AbstractTest {
|
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
|
// Verify we can pass an unknown env var in configure options and it will be
|
||||||
// nulled out
|
// nulled out
|
||||||
// Verifies fix for Bug: #303616
|
// Verifies fix for Bug: #303616
|
||||||
|
|
|
@ -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.junit.SWTBotJunit4ClassRunner;
|
||||||
import org.eclipse.swtbot.swt.finder.waits.Conditions;
|
import org.eclipse.swtbot.swt.finder.waits.Conditions;
|
||||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -35,11 +34,6 @@ import org.junit.runners.MethodSorters;
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class TestMakeTargets extends AbstractTest {
|
public class TestMakeTargets extends AbstractTest {
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void beforeClass() throws Exception {
|
|
||||||
AbstractTest.init("GnuProject3");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Verify we can build and run the info MakeTarget tool
|
// Verify we can build and run the info MakeTarget tool
|
||||||
public void t1canBuildAndAccessInfoTarget() throws Exception {
|
public void t1canBuildAndAccessInfoTarget() throws Exception {
|
||||||
|
|
|
@ -20,7 +20,6 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
|
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
|
||||||
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
|
||||||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.FixMethodOrder;
|
import org.junit.FixMethodOrder;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
@ -30,11 +29,6 @@ import org.junit.runners.MethodSorters;
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class TestToolActions extends AbstractTest {
|
public class TestToolActions extends AbstractTest {
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void beforeClass() throws Exception {
|
|
||||||
AbstractTest.init("GnuProject4");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
// Verify we can set the tools via the Autotools Tools page
|
// Verify we can set the tools via the Autotools Tools page
|
||||||
public void t1canSeeTools() throws Exception {
|
public void t1canSeeTools() throws Exception {
|
||||||
|
|
Loading…
Add table
Reference in a new issue