mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Fix Autotools UI SWTBot tests
- force tests to be run in file order by requesting alphabetic order and renaming tests to they alphabetic equals file order - fix configuration test which looks for C/C++ Build page from properties by looking for it in the properties search text box - put configuration tests last in suite Change-Id: I21b943c2a6691f9277bc8cc712684f2bc1fd2db4 Reviewed-on: https://git.eclipse.org/r/35767 Tested-by: Hudson CI Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
parent
4b833a066a
commit
bf95b80b05
6 changed files with 44 additions and 25 deletions
|
@ -61,7 +61,9 @@ public abstract class AbstractTest {
|
|||
|
||||
public static void init(String projectName) throws Exception {
|
||||
SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
|
||||
SWTBotPreferences.PLAYBACK_DELAY = 10;
|
||||
bot = new SWTWorkbenchBot();
|
||||
bot.sleep(5000);
|
||||
mainShell = null;
|
||||
for (int i = 0, attempts = 100; i < attempts; i++) {
|
||||
for (SWTBotShell shell : bot.shells()) {
|
||||
|
|
|
@ -21,10 +21,10 @@ import org.junit.runners.Suite;
|
|||
|
||||
@RunWith(Suite.class)
|
||||
@Suite.SuiteClasses({
|
||||
SetConfigurationParameter.class,
|
||||
TestToolActions.class,
|
||||
TestEnvironmentVars.class,
|
||||
TestMakeTargets.class
|
||||
TestToolActions.class,
|
||||
TestEnvironmentVars.class,
|
||||
TestMakeTargets.class,
|
||||
SetConfigurationParameter.class
|
||||
})
|
||||
|
||||
public class AllTests {
|
||||
|
|
|
@ -22,6 +22,7 @@ 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;
|
||||
|
@ -34,8 +35,10 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
|
|||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
|
||||
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;
|
||||
import org.junit.runners.MethodSorters;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
|
@ -43,6 +46,7 @@ import org.w3c.dom.Node;
|
|||
import org.w3c.dom.NodeList;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class SetConfigurationParameter extends AbstractTest {
|
||||
|
||||
@BeforeClass
|
||||
|
@ -96,7 +100,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
|||
// Verify we can set a configuration parameter and that it is recorded in
|
||||
// the .autotools file for the project
|
||||
@Test
|
||||
public void canSetConfigParm() throws Exception {
|
||||
public void t1canSetConfigParm() throws Exception {
|
||||
IProject project = checkProject();
|
||||
assertTrue(project != null);
|
||||
IPath path = project.getLocation();
|
||||
|
@ -137,7 +141,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
|||
// Verify we can build the project with a configuration parameter and that
|
||||
// the configuration parameter can be found in the config.status file.
|
||||
@Test
|
||||
public void canBuildWithConfigParm() throws Exception {
|
||||
public void t2canBuildWithConfigParm() throws Exception {
|
||||
projectExplorer.bot().tree().select(projectName);
|
||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
||||
"Build Project");
|
||||
|
@ -217,7 +221,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
|||
// Verify a new configuration will copy the configuration parameters
|
||||
// of its base configuration.
|
||||
@Test
|
||||
public void newConfigCopiesParms() throws Exception {
|
||||
public void t3newConfigCopiesParms() throws Exception {
|
||||
projectExplorer.bot().tree().select(projectName);
|
||||
clickContextMenu(projectExplorer.bot().tree().select(projectName),
|
||||
"Build Configurations", "Manage...");
|
||||
|
@ -249,6 +253,10 @@ public class SetConfigurationParameter extends AbstractTest {
|
|||
assertEquals("--enable-jeff", val);
|
||||
// Verify that the build directory for the new configuration has been
|
||||
// switched to build-debug
|
||||
shell = bot.shell("Properties for " + projectName);
|
||||
shell.activate();
|
||||
bot.text().setText("");
|
||||
|
||||
bot.tree().select("C/C++ Build");
|
||||
String buildDir = bot.textWithLabel("Build directory:").getText();
|
||||
assertTrue(buildDir.endsWith("build-debug"));
|
||||
|
@ -368,7 +376,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
|||
// configuration to
|
||||
// another and then cancel without changing configuration settings.
|
||||
@Test
|
||||
public void doubleRenameCancel() throws Exception {
|
||||
public void t4doubleRenameCancel() throws Exception {
|
||||
openProperties("Autotools", "Configure Settings");
|
||||
SWTBotCombo configs = bot.comboBoxWithLabel("Configuration: ");
|
||||
bot.button("Manage Configurations...").click();
|
||||
|
@ -423,7 +431,7 @@ public class SetConfigurationParameter extends AbstractTest {
|
|||
// configuration to
|
||||
// another and inheriting the settings properly.
|
||||
@Test
|
||||
public void doubleRenameOk() throws Exception {
|
||||
public void t5doubleRenameOk() throws Exception {
|
||||
openProperties("Autotools", "Configure Settings");
|
||||
SWTBotCombo configs = bot.comboBoxWithLabel("Configuration: ");
|
||||
bot.button("Manage Configurations...").click();
|
||||
|
|
|
@ -25,10 +25,13 @@ 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;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class TestEnvironmentVars extends AbstractTest {
|
||||
|
||||
@BeforeClass
|
||||
|
@ -40,7 +43,7 @@ public class TestEnvironmentVars extends AbstractTest {
|
|||
// nulled out
|
||||
// Verifies fix for Bug: #303616
|
||||
@Test
|
||||
public void referenceUnknownEnvVar() throws Exception {
|
||||
public void t1referenceUnknownEnvVar() throws Exception {
|
||||
SWTBotShell shell = openProperties("Autotools", "Configure Settings");
|
||||
// Set the configure parameters to be --enable-jeff via user-defined
|
||||
// options
|
||||
|
@ -80,7 +83,7 @@ public class TestEnvironmentVars extends AbstractTest {
|
|||
// Verify we can set an environment variable and use it as a configure
|
||||
// parameter
|
||||
// Verifies fix for Bug: #303616
|
||||
public void setEnvVar() throws Exception {
|
||||
private void setEnvVar() throws Exception {
|
||||
openProperties("C/C++ Build", "Environment");
|
||||
bot.button("Add...").click();
|
||||
SWTBotShell shell = bot.shell("New variable");
|
||||
|
@ -124,7 +127,7 @@ public class TestEnvironmentVars extends AbstractTest {
|
|||
// Verify we can set an environment variable prior to the configuration
|
||||
// command and
|
||||
// it will be seen by the configure script
|
||||
public void setEnvVarOnCommandLine() throws Exception {
|
||||
private void setEnvVarOnCommandLine() throws Exception {
|
||||
IPath path = checkProject().getLocation();
|
||||
// Create a fake configure script which prints out the values of
|
||||
// envvars some_var1, some_var2, and some_var3
|
||||
|
|
|
@ -26,10 +26,13 @@ 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;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class TestMakeTargets extends AbstractTest {
|
||||
|
||||
@BeforeClass
|
||||
|
@ -39,7 +42,7 @@ public class TestMakeTargets extends AbstractTest {
|
|||
|
||||
@Test
|
||||
// Verify we can build and run the info MakeTarget tool
|
||||
public void canBuildAndAccessInfoTarget() throws Exception {
|
||||
public void t1canBuildAndAccessInfoTarget() throws Exception {
|
||||
clickProjectContextMenu("Build Project");
|
||||
|
||||
// Wait until the project is built
|
||||
|
|
|
@ -21,20 +21,23 @@ 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;
|
||||
import org.junit.runners.MethodSorters;
|
||||
|
||||
@RunWith(SWTBotJunit4ClassRunner.class)
|
||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||
public class TestToolActions extends AbstractTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
AbstractTest.init("GnuProject1");
|
||||
AbstractTest.init("GnuProject4");
|
||||
}
|
||||
|
||||
@Test
|
||||
// Verify we can set the tools via the Autotools Tools page
|
||||
public void canSeeTools() throws Exception {
|
||||
public void t1canSeeTools() throws Exception {
|
||||
openProperties("Autotools", "General");
|
||||
bot.tabItem("Tools Settings").activate();
|
||||
String aclocalName = bot.textWithLabel("aclocal").getText();
|
||||
|
@ -54,7 +57,7 @@ public class TestToolActions extends AbstractTest {
|
|||
|
||||
// Verify we can access the aclocal tool
|
||||
@Test
|
||||
public void canAccessAclocal() throws Exception {
|
||||
public void t2canAccessAclocal() throws Exception {
|
||||
IPath path = checkProject().getLocation();
|
||||
// Verify configure does not exist initially
|
||||
path = path.append("aclocal.m4");
|
||||
|
@ -108,7 +111,7 @@ public class TestToolActions extends AbstractTest {
|
|||
|
||||
// Verify we can access the autoconf tool
|
||||
@Test
|
||||
public void canAccessAutoconf() throws Exception {
|
||||
public void t3canAccessAutoconf() throws Exception {
|
||||
IPath path = checkProject().getLocation();
|
||||
// Verify configure does not exist initially
|
||||
path = path.append("configure");
|
||||
|
@ -171,7 +174,7 @@ public class TestToolActions extends AbstractTest {
|
|||
|
||||
// Verify we can access the automake tool
|
||||
@Test
|
||||
public void canAccessAutomake() throws Exception {
|
||||
public void t4canAccessAutomake() throws Exception {
|
||||
IPath path = checkProject().getLocation();
|
||||
// Verify configure does not exist initially
|
||||
IPath path2 = path.append("src/Makefile.in");
|
||||
|
@ -242,7 +245,7 @@ public class TestToolActions extends AbstractTest {
|
|||
|
||||
// Verify we can access the libtoolize tool
|
||||
@Test
|
||||
public void canAccessLibtoolize() throws Exception {
|
||||
public void t5canAccessLibtoolize() throws Exception {
|
||||
clickProjectContextMenu("Invoke Autotools", "Invoke Libtoolize");
|
||||
SWTBotShell shell = bot.shell("Libtoolize Options");
|
||||
shell.activate();
|
||||
|
@ -261,13 +264,13 @@ public class TestToolActions extends AbstractTest {
|
|||
|
||||
// Verify we can access the libtoolize tool
|
||||
@Test
|
||||
public void canAccessAutoheader() throws Exception {
|
||||
public void t6canAccessAutoheader() throws Exception {
|
||||
clickProjectContextMenu("Invoke Autotools", "Invoke Autoheader");
|
||||
SWTBotShell shell = bot.shell("Autoheader Options");
|
||||
shell.activate();
|
||||
bot.text(0).typeText("--help");
|
||||
bot.button("OK").click();
|
||||
bot.sleep(1000);
|
||||
bot.sleep(2000);
|
||||
SWTBotView consoleView = bot.viewByPartName("Console");
|
||||
consoleView.setFocus();
|
||||
String output = consoleView.bot().styledText().getText();
|
||||
|
@ -280,7 +283,7 @@ public class TestToolActions extends AbstractTest {
|
|||
|
||||
// Verify we can access the autoreconf tool
|
||||
@Test
|
||||
public void canAccessAutoreconf() throws Exception {
|
||||
public void t7canAccessAutoreconf() throws Exception {
|
||||
IPath path = checkProject().getLocation();
|
||||
// Remove a number of generated files
|
||||
File f = new File(path.append("src/Makefile.in").toOSString());
|
||||
|
@ -339,7 +342,7 @@ public class TestToolActions extends AbstractTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void canReconfigureProject() throws Exception {
|
||||
public void t8canReconfigureProject() throws Exception {
|
||||
IPath path = checkProject().getLocation();
|
||||
// Remove a number of generated files
|
||||
File f = new File(path.append("src/Makefile.in").toOSString());
|
||||
|
@ -389,7 +392,7 @@ public class TestToolActions extends AbstractTest {
|
|||
// Verify we can set and reset the tools via the Autotools Tools page
|
||||
// Verifies bug #317345
|
||||
@Test
|
||||
public void canResetTools() throws Exception {
|
||||
public void t9canResetTools() throws Exception {
|
||||
openProperties("Autotools", "General");
|
||||
bot.tabItem("Tools Settings").activate();
|
||||
bot.textWithLabel("aclocal").setText("");
|
||||
|
@ -435,7 +438,7 @@ public class TestToolActions extends AbstractTest {
|
|||
|
||||
// Verify we can set the tools via the Autotools Tools page
|
||||
@Test
|
||||
public void canSetTools() throws Exception {
|
||||
public void u1canSetTools() throws Exception {
|
||||
openProperties("Autotools", "General");
|
||||
bot.tabItem("Tools Settings").activate();
|
||||
bot.textWithLabel("aclocal").setText("");
|
||||
|
|
Loading…
Add table
Reference in a new issue