Skip to content

Commit

Permalink
Merge pull request #90 from LorenzoBettini/task_88-Flaky_UI_tests_int…
Browse files Browse the repository at this point in the history
…erpreter_timeout

88: profile for SWTBot tests without Eclipse distribution
  • Loading branch information
LorenzoBettini committed Jan 13, 2020
2 parents 1f94bd4 + 8d97e0d commit 979898c
Show file tree
Hide file tree
Showing 13 changed files with 147 additions and 128 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ before_cache:
after_success:
- find ./edelta.parent/edelta.ui.tests/target/ -name "*.log"

after_failure:
- find ./edelta.parent/*/target/work/ -name "*.log" -exec cat {} \;
- find ./edelta.parent/*/target/it/ -name "*.log" -exec cat {} \;
#after_failure:
# - find ./edelta.parent/*/target/work/ -name "*.log" -exec cat {} \;
# - find ./edelta.parent/*/target/it/ -name "*.log" -exec cat {} \;
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8
encoding/model=UTF-8
encoding/edelta-gen=UTF-8
encoding/model=UTF-8
188 changes: 116 additions & 72 deletions edelta.parent/edelta.swtbot.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<properties>
<test-work-directory>${project.build.directory}/work/edelta</test-work-directory>
<additionalTestArgLine>-Dorg.eclipse.swtbot.search.timeout=20000</additionalTestArgLine>
<uiTestProperties>-Dedelta.interpreter.timeout=5000</uiTestProperties>
<!-- Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=397015 -->
<sonar.sources></sonar.sources>
<sonar.tests>src</sonar.tests>
Expand All @@ -35,78 +36,121 @@
<test-work-directory>${project.build.directory}/work/edelta.app/Contents/Eclipse/</test-work-directory>
</properties>
</profile>
</profiles>

<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[2.8,)</versionRange>
<goals>
<goal>unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- unpack provisioned product archive before running tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-product</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<profile>
<!-- To run it locally, without using an Edelta Eclipse distribution -->
<id>local-swtbot-test</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-feature</type>
<id>edelta.feature</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-feature</type>
<id>edelta.product.ui.feature</id>
<versionRange>0.0.0</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- requires a built product, e.g., activate the profile build-ide as well -->
<id>test-ide</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[2.8,)</versionRange>
<goals>
<goal>unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- unpack provisioned product archive before running tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-product</id>
<phase>compile</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>edelta.product.repository</artifactId>
<version>${project.version}</version>
<type>zip</type>
<classifier>${tycho.env.osgi.os}.${tycho.env.osgi.ws}.${tycho.env.osgi.arch}</classifier>
<!-- this is where tycho surefire expects/creates the installation
under test by default -->
<outputDirectory>${project.build.directory}/work</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>edelta.product.repository</artifactId>
<version>${project.version}</version>
<type>zip</type>
<classifier>${tycho.env.osgi.os}.${tycho.env.osgi.ws}.${tycho.env.osgi.arch}</classifier>
<!-- this is where tycho surefire expects/creates the installation
under test by default -->
<outputDirectory>${project.build.directory}/work</outputDirectory>
</artifactItem>
</artifactItems>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<testRuntime>p2Installed</testRuntime>
<work>${test-work-directory}</work>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<testRuntime>p2Installed</testRuntime>
<work>${test-work-directory}</work>
</configuration>
</plugin>
</plugins>
</build>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
import static org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil.cleanWorkspace;
import static org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil.reallyWaitForAutoBuild;
import static org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil.root;
import static org.eclipse.xtext.ui.testing.util.IResourcesSetupUtil.waitForBuild;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -43,7 +42,6 @@ public static void beforeClass() throws Exception {

closeWelcomePage();

bot.viewByPartName("Problems").show();
bot.menu("Window").menu("Show View").menu(PROJECT_EXPLORER).click();
}

Expand Down Expand Up @@ -173,7 +171,8 @@ protected void createProjectAndAssertCreated(String projectName) {
bot.waitUntil(shellCloses(shell), SWTBotPreferences.TIMEOUT);
assertProjectCreated(projectName);

reallyWaitForAutoBuild();
System.out.println("Waiting for build...");
waitForBuild();
}

protected void assertProjectCreated(String projectName) {
Expand Down
1 change: 0 additions & 1 deletion edelta.parent/edelta.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Require-Bundle: edelta.ui,
org.eclipse.ui.workbench;resolution:=optional,
org.eclipse.xtext.common.types.ui,
org.eclipse.jdt.core,
org.eclipse.pde.core;bundle-version="3.11.0",
org.eclipse.ui.ide,
org.eclipse.xtext.testing,
org.eclipse.xtext.xbase.testing,
Expand Down
22 changes: 3 additions & 19 deletions edelta.parent/edelta.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<packaging>eclipse-test-plugin</packaging>

<properties>
<systemProperties>-DbuildingWithTycho=true</systemProperties>
<uiTestProperties>-Dedelta.interpreter.timeout=5000</uiTestProperties>
</properties>

<profiles>
Expand All @@ -30,15 +30,7 @@
<artifactId>target-platform-configuration</artifactId>
<configuration>
<dependency-resolution>
<extraRequirements>
<!-- to get the org.eclipse.osgi.compatibility.state plugin
if the target platform is Luna or later. (backward compatible with kepler
and previous versions) see https://bugs.eclipse.org/bugs/show_bug.cgi?id=492149 -->
<requirement>
<type>eclipse-feature</type>
<id>org.eclipse.rcp</id>
<versionRange>0.0.0</versionRange>
</requirement>
<extraRequirements combine.children="append">
<!-- We specify our feature so that we're sure we're using
also all the required software -->
<requirement>
Expand Down Expand Up @@ -74,15 +66,7 @@
<artifactId>target-platform-configuration</artifactId>
<configuration>
<dependency-resolution>
<extraRequirements>
<!-- to get the org.eclipse.osgi.compatibility.state plugin
if the target platform is Luna or later. (backward compatible with kepler
and previous versions) see https://bugs.eclipse.org/bugs/show_bug.cgi?id=492149 -->
<requirement>
<type>eclipse-feature</type>
<id>org.eclipse.rcp</id>
<versionRange>0.0.0</versionRange>
</requirement>
<extraRequirements combine.children="append">
<!-- We specify our feature so that we're sure we're using
also all the required software -->
<requirement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package edelta.ui.tests

import edelta.ui.internal.EdeltaActivator
import edelta.ui.tests.utils.EdeltaPluginProjectHelper
import edelta.ui.tests.utils.PDETargetPlatformUtils
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
Expand Down Expand Up @@ -41,10 +40,6 @@ class EdeltaContentAssistTest extends AbstractContentAssistTest {

@BeforeClass
def static void setUp() {
// needed when building with Tycho, otherwise, dependencies
// in the MANIFEST of the created project will not be visible
PDETargetPlatformUtils.setTargetPlatform();

closeWelcomePage
val injector = EdeltaActivator.getInstance().getInjector(EdeltaActivator.EDELTA_EDELTA);
val projectHelper = injector.getInstance(EdeltaPluginProjectHelper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package edelta.ui.tests
import com.google.inject.Inject
import com.google.inject.Provider
import edelta.ui.tests.utils.EdeltaTestableNewProjectWizard
import edelta.ui.tests.utils.PDETargetPlatformUtils
import edelta.ui.tests.utils.PluginProjectHelper
import org.eclipse.jface.viewers.StructuredSelection
import org.eclipse.jface.wizard.Wizard
Expand All @@ -13,7 +12,6 @@ import org.eclipse.xtext.testing.Flaky
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.eclipse.xtext.ui.testing.AbstractWorkbenchTest
import org.junit.BeforeClass
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand Down Expand Up @@ -67,11 +65,6 @@ class EdeltaNewProjectWizardTest extends AbstractWorkbenchTest {
return dialog.open();
}

@BeforeClass
def static void beforeClass() {
PDETargetPlatformUtils.setTargetPlatform();
}

@Test @Flaky
def void testEdeltaNewProjectWizard() {
println("*** Executing testEdeltaNewProjectWizard...")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ package edelta.ui.tests
import com.google.inject.Inject
import edelta.ui.internal.EdeltaActivator
import edelta.ui.tests.utils.EdeltaPluginProjectHelper
import edelta.ui.tests.utils.PDETargetPlatformUtils
import org.eclipse.core.runtime.CoreException
import org.eclipse.xtext.testing.Flaky
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.eclipse.xtext.ui.testing.AbstractOutlineTest
import org.junit.BeforeClass
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand All @@ -34,11 +32,6 @@ class EdeltaOutlineTest extends AbstractOutlineTest {
edeltaProjectHelper.createEdeltaPluginProject(TEST_PROJECT)
}

@BeforeClass
def static void beforeClass() {
PDETargetPlatformUtils.setTargetPlatform();
}

@Test
def void testOutlineWithNoContents() {
''''''.assertAllLabels(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ package edelta.ui.tests

import com.google.inject.Inject
import edelta.ui.tests.utils.EdeltaPluginProjectHelper
import edelta.ui.tests.utils.PDETargetPlatformUtils
import edelta.ui.tests.utils.PluginProjectHelper
import org.eclipse.core.resources.IProject
import org.eclipse.xtext.ui.testing.AbstractWorkbenchTest
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.eclipse.xtext.ui.testing.AbstractWorkbenchTest
import org.junit.Before
import org.junit.BeforeClass
import org.junit.Test
import org.junit.runner.RunWith

Expand All @@ -27,11 +25,6 @@ class EdeltaWorkbenchIntegrationTest extends AbstractWorkbenchTest {

val TEST_PROJECT = "mytestproject"

@BeforeClass
def static void beforeClass() {
PDETargetPlatformUtils.setTargetPlatform();
}

@Before
override void setUp() {
super.setUp
Expand Down

0 comments on commit 979898c

Please sign in to comment.