Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorCamille Letavernier2014-03-10 12:18:14 -0400
committerCamille Letavernier2014-03-10 12:18:14 -0400
commit3fe95791a9670bae8031ef54d1c81219aff38df3 (patch)
tree03317d6203f2b8a48187c610d8247ff5e665eabb /tests
parent7d9e1710902d42403aabb1783159249365d8c68d (diff)
downloadorg.eclipse.papyrus-3fe95791a9670bae8031ef54d1c81219aff38df3.tar.gz
org.eclipse.papyrus-3fe95791a9670bae8031ef54d1c81219aff38df3.tar.xz
org.eclipse.papyrus-3fe95791a9670bae8031ef54d1c81219aff38df3.zip
430023: [Papyrus Tests] Papyrus shall propose different levels of
testing, to allow test-driven development https://bugs.eclipse.org/bugs/show_bug.cgi?id=430023
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java24
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java7
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/TestMode.java42
-rw-r--r--tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java12
6 files changed, 72 insertions, 19 deletions
diff --git a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF
index c8514a339c6..03d3428ab1a 100644
--- a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.pde;bundle-version="3.7.0",
org.eclipse.pde.core,
org.eclipse.update.configurator,
- org.junit;bundle-version="4.10.0"
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.bundles.tests
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
diff --git a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
index 5b43e68aedb..8d90eb5853f 100644
--- a/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
+++ b/tests/junit/plugins/developer/org.eclipse.papyrus.bundles.tests/src/org/eclipse/papyrus/bundles/tests/BundlesTests.java
@@ -1,7 +1,7 @@
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
*
- *
+ *
* 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
@@ -22,8 +22,10 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.junit.utils.TestMode;
import org.eclipse.pde.internal.core.feature.Feature;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -113,6 +115,8 @@ public class BundlesTests {
*/
@Test
public void importPackage() {
+ Assume.assumeTrue("Usage of importPackage is discouraged", TestMode.isStrict()); //$NON-NLS-1$
+
testManifestProperty(BundleTestsUtils.BUNDLE_IMPORT_PACKAGE, "", true, false); //$NON-NLS-1$
}
@@ -121,6 +125,8 @@ public class BundlesTests {
*/
@Test
public void reexportDependencies() {
+ Assume.assumeTrue("Usage of reexported dependencies is discouraged", TestMode.isStrict());
+
StringBuffer message = new StringBuffer();
int nb = 0;
for(final Bundle current : BundleTestsUtils.getPapyrusBundles()) {
@@ -139,18 +145,18 @@ public class BundlesTests {
if(bundle.contains(";")) { //$NON-NLS-1$
localMessage.append(NLS.bind("\n - {0}", bundle.substring(0, bundle.indexOf(";")))); //$NON-NLS-1$ //$NON-NLS-2$
} else {
- localMessage.append(NLS.bind("\n - {0}", bundle)); //$NON-NLS-1$
+ localMessage.append(NLS.bind("\n - {0}", bundle)); //$NON-NLS-1$
}
}
}
if(localMessage.length() != 0) {
message.append(localMessage);
- message.append("\n");//$NON-NLS-1$
+ message.append("\n");//$NON-NLS-1$
}
}
StringBuffer errorMessage = new StringBuffer();
errorMessage.append(nb);
- errorMessage.append(" problems!");//$NON-NLS-1$
+ errorMessage.append(" problems!");//$NON-NLS-1$
errorMessage.append(message);
Assert.assertTrue(errorMessage.toString(), nb == 0);
}
@@ -416,6 +422,8 @@ public class BundlesTests {
*/
@Test
public void documentationFileTest() {
+ Assume.assumeTrue("It is a good practice to add a plugin.pdoc file to each plug-in", TestMode.isStrict());
+
String message = null;
int nb = 0;
for(final Bundle bundle : BundleTestsUtils.getPapyrusBundles()) {
@@ -439,8 +447,8 @@ public class BundlesTests {
StringBuffer errorMessage = new StringBuffer();
StringBuffer warningMessage = new StringBuffer();
final Collection<String> possibleIds = new ArrayList<String>();
- possibleIds.add("ID");//$NON-NLS-1$
- possibleIds.add("PLUGIN_ID");//$NON-NLS-1$
+ possibleIds.add("ID");//$NON-NLS-1$
+ possibleIds.add("PLUGIN_ID");//$NON-NLS-1$
int nbError = 0;
int nbWarning = 0;
for(final Bundle current : BundleTestsUtils.getPapyrusBundles()) {
@@ -480,10 +488,10 @@ public class BundlesTests {
finalErrorMessage.append(nbError);
finalErrorMessage.append(" problems! ");//$NON-NLS-1$
finalErrorMessage.append(errorMessage);
- Assert.assertTrue(finalErrorMessage.toString(), nbError == 0); //$NON-NLS-1$
+ Assert.assertTrue(finalErrorMessage.toString(), nbError == 0);
// Do not fail on warnings
- //Assert.assertTrue(nbWarning + "warning!" + warningMessage, nbWarning == 0);//$NON-NLS-1$
+ //Assert.assertTrue(nbWarning + "warning!" + warningMessage, nbWarning == 0);//$NON-NLS-1$
}
}
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF
index 915af9d0366..fa967ff57b5 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/META-INF/MANIFEST.MF
@@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.0.0",
org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.0.0",
- org.eclipse.core.databinding;bundle-version="1.4.1"
+ org.eclipse.core.databinding;bundle-version="1.4.1",
+ org.eclipse.papyrus.junit.utils;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.infra.gmfdiag.css.tests,
org.eclipse.papyrus.infra.gmfdiag.css.tests.tests
Bundle-Vendor: Eclipse Modeling Project
diff --git a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
index 0f43da39e6d..d2d3e4b59c6 100644
--- a/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
+++ b/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.css.tests/src/org/eclipse/papyrus/infra/gmfdiag/css/tests/tests/CSSCompartmentsTests.java
@@ -36,11 +36,12 @@ import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.helper.ResetStyleHelper;
import org.eclipse.papyrus.infra.gmfdiag.css.notation.CSSDiagram;
import org.eclipse.papyrus.infra.gmfdiag.css.tests.Activator;
+import org.eclipse.papyrus.junit.utils.TestMode;
import org.eclipse.uml2.uml.NamedElement;
import org.junit.After;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
/**
@@ -111,9 +112,8 @@ public class CSSCompartmentsTests {
/* Test Enumeration1 */
@Test
- //Currently fails. The "case insensitive" attributes are not supported by Eclipse E4 CSS
- @Ignore("The 'case insensitive' attributes are not supported by Eclipse E4 CSS")
public void testCaseInsensitiveForEnumeration() {
+ Assume.assumeTrue("The 'case insensitive' attributes are not supported by Eclipse E4 CSS", TestMode.isStrict());
Shape enumeration = findShape("Enumeration1");
BasicCompartment compartment = findCompartment(enumeration, ENUMERATION_LITERAL_COMPARTMENT_TYPE);
@@ -121,7 +121,6 @@ public class CSSCompartmentsTests {
}
/* Test Interface 1 and Interface 2 */
- //Currently fails. The interface compartments are not defined in the NotationTypesMap
@Test
public void testAttributeCompartmentForInterface() {
Shape interface1 = findShape("Interface1");
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/TestMode.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/TestMode.java
new file mode 100644
index 00000000000..1cfcfb95686
--- /dev/null
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/TestMode.java
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.junit.utils;
+
+
+
+/**
+ * This class is used to configure a test job. In strict mode, all tests are executed.
+ * When the strict mode is disabled, the tests which are known to be failing are ignored.
+ *
+ * This is useful for test-driven development, when tests are implemented before the feature:
+ * we can still have "green builds" (by ignoring these specific tests) and test for non-regression.
+ *
+ * Usage: When a test is known to be failing, add: Assume.assumeTrue("Why the test is disabled", TestMode.isStrict());
+ *
+ * The test will be run only in strict mode, and ignored during non-regression testing
+ *
+ * @author Camille Letavernier
+ *
+ */
+public class TestMode {
+
+ private static boolean strictMode = false;
+
+ public static boolean isStrict() {
+ return strictMode;
+ }
+
+ public static void setStrict(boolean strictMode) {
+ TestMode.strictMode = strictMode;
+ }
+
+}
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java
index 8badbb23d40..36d89cc8e52 100644
--- a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java
+++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/DependencyManagementTest.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 CEA LIST.
- *
+ *
* 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
@@ -23,6 +23,7 @@ import org.eclipse.papyrus.infra.emf.resource.DependencyManagementHelper;
import org.eclipse.papyrus.junit.utils.ModelUtils;
import org.eclipse.papyrus.junit.utils.PapyrusProjectUtils;
import org.eclipse.papyrus.junit.utils.ProjectUtils;
+import org.eclipse.papyrus.junit.utils.TestMode;
import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest;
import org.eclipse.papyrus.uml.tools.tests.Activator;
import org.eclipse.uml2.uml.Model;
@@ -31,6 +32,7 @@ import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.util.UMLUtil;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -106,12 +108,12 @@ public class DependencyManagementTest extends AbstractEditorTest {
}
//Switch from two different versions of a profile
- //Problem: !!Stereotypes are not references!! They are instances. After the switch, the new
+ //Problem: !!Stereotypes are not references!! They are instances. After the switch, the new
//profile is correctly applied, but the applied Stereotypes are the ones from the initial Profile
- //
- //Current state: FAILS
@Test
public void testSwitchProfilesWithStereotypes() throws Exception {
+ Assume.assumeTrue("Bug 408491 is not yet implemented", TestMode.isStrict());
+
IProject project = ProjectUtils.createProject("dependencyManagement.switchProfiles");
PapyrusProjectUtils.copyPapyrusModel(project, getBundle(), getSourcePath(), "profiles/model");
PapyrusProjectUtils.copyPapyrusModel(project, getBundle(), getSourcePath(), "profiles/p1/profile1.profile");
@@ -143,7 +145,7 @@ public class DependencyManagementTest extends AbstractEditorTest {
});
- //After the transformation, stereotypes from the target profile must be applied
+ //After the transformation, stereotypes from the target profile must be applied
checkAppliedProfileAndStereotypes(modelSet, rootModel, targetProfileURI);
//Save, reload, and check again

Back to the top