mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 00:38:56 +00:00
new approach to automated testing
This commit is contained in:
parent
8360cfc76e
commit
f17aee6007
5 changed files with 5 additions and 183 deletions
|
@ -15,45 +15,4 @@ Require-Bundle: org.antlr;bundle-version="3.0.0",
|
|||
org.openarchitectureware.dependencies;bundle-version="4.3.0",
|
||||
org.eclipse.emf.compare,
|
||||
org.eclipse.emf.compare.diff,
|
||||
org.eclipse.emf.compare.match,
|
||||
com.rcpquickstart.bundletestcollector;bundle-version="1.0.0",
|
||||
org.eclipse.xtext.ui;bundle-version="1.0.0"
|
||||
Export-Package: org.eclipse.xtext,
|
||||
org.eclipse.xtext.dummy,
|
||||
org.eclipse.xtext.dummy.parser,
|
||||
org.eclipse.xtext.dummy.parser.internal,
|
||||
org.eclipse.xtext.dummy.parsetree.reconstr,
|
||||
org.eclipse.xtext.dummy.services,
|
||||
org.eclipse.xtext.generator.resource,
|
||||
org.eclipse.xtext.grammarinheritance,
|
||||
org.eclipse.xtext.grammarinheritance.parser,
|
||||
org.eclipse.xtext.grammarinheritance.parser.internal,
|
||||
org.eclipse.xtext.grammarinheritance.parsetree.reconstr,
|
||||
org.eclipse.xtext.grammarinheritance.services,
|
||||
org.eclipse.xtext.lexer,
|
||||
org.eclipse.xtext.metamodelreferencing.tests,
|
||||
org.eclipse.xtext.metamodelreferencing.tests.parser,
|
||||
org.eclipse.xtext.metamodelreferencing.tests.parser.internal,
|
||||
org.eclipse.xtext.metamodelreferencing.tests.parsetree.reconstr,
|
||||
org.eclipse.xtext.metamodelreferencing.tests.services,
|
||||
org.eclipse.xtext.parseerrorhandling,
|
||||
org.eclipse.xtext.parser,
|
||||
org.eclipse.xtext.parser.internal,
|
||||
org.eclipse.xtext.parsetree,
|
||||
org.eclipse.xtext.parsetree.reconstr,
|
||||
org.eclipse.xtext.parsetree.reconstr.parser,
|
||||
org.eclipse.xtext.parsetree.reconstr.parser.internal,
|
||||
org.eclipse.xtext.parsetree.reconstr.parsetree.reconstr,
|
||||
org.eclipse.xtext.parsetree.reconstr.services,
|
||||
org.eclipse.xtext.reference,
|
||||
org.eclipse.xtext.services,
|
||||
org.eclipse.xtext.testlanguages,
|
||||
org.eclipse.xtext.testlanguages.parser,
|
||||
org.eclipse.xtext.testlanguages.parser.internal,
|
||||
org.eclipse.xtext.testlanguages.parsetree.reconstr,
|
||||
org.eclipse.xtext.testlanguages.services,
|
||||
org.eclipse.xtext.tests,
|
||||
org.eclipse.xtext.typeresolution,
|
||||
org.eclipse.xtext.xtext2ecore
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Activator: org.eclipse.xtext.Activator
|
||||
org.eclipse.emf.compare.match
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package org.eclipse.xtext;
|
||||
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
public class Activator extends Plugin {
|
||||
|
||||
// The plug-in ID
|
||||
public static final String PLUGIN_ID = "org.eclipse.xtext.generator.tests";
|
||||
|
||||
// The shared instance
|
||||
private static Activator plugin;
|
||||
|
||||
public Activator() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public void start(BundleContext context) throws Exception {
|
||||
super.start(context);
|
||||
setDefault(this);
|
||||
}
|
||||
|
||||
private static void setDefault(Activator activator) {
|
||||
plugin = activator;
|
||||
}
|
||||
|
||||
public void stop(BundleContext context) throws Exception {
|
||||
setDefault(null);
|
||||
super.stop(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the shared instance
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
public static Activator getDefault() {
|
||||
return plugin;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
|
||||
* 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
|
||||
*
|
||||
*******************************************************************************/
|
||||
package org.eclipse.xtext;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import com.rcpquickstart.bundletestcollector.BundleTestCollector;
|
||||
|
||||
|
||||
/**
|
||||
* @author Jan Köhnlein - Initial contribution and API
|
||||
*
|
||||
*/
|
||||
public class AllTests {
|
||||
|
||||
public static boolean isPluginContext = false;
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("Test for org.eclipse.xtext");
|
||||
new BundleTestCollector().collectTests(suite, "org.eclipse.xtext.generator.tests", "", "*");
|
||||
isPluginContext = true;
|
||||
return suite;
|
||||
}
|
||||
|
||||
}
|
|
@ -6,8 +6,6 @@ import org.eclipse.emf.common.util.EList;
|
|||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.emf.ecore.EPackage;
|
||||
import org.eclipse.xtext.Activator;
|
||||
import org.eclipse.xtext.AllTests;
|
||||
import org.eclipse.xtext.Grammar;
|
||||
import org.eclipse.xtext.GrammarUtil;
|
||||
import org.eclipse.xtext.LexerRule;
|
||||
|
@ -17,7 +15,6 @@ import org.eclipse.xtext.parsetree.SyntaxError;
|
|||
import org.eclipse.xtext.resource.XtextResource;
|
||||
import org.eclipse.xtext.resource.XtextResourceSet;
|
||||
import org.eclipse.xtext.tests.AbstractGeneratorTest;
|
||||
import org.eclipse.xtext.ui.util.BundleClasspathUriResolver;
|
||||
import org.eclipse.xtext.xtextutil.AbstractType;
|
||||
import org.eclipse.xtext.xtextutil.ComplexType;
|
||||
import org.eclipse.xtext.xtextutil.Feature;
|
||||
|
@ -102,10 +99,10 @@ public class ToEcoreTrafoTest extends AbstractGeneratorTest {
|
|||
|
||||
private XtextResource getResource(String uri) {
|
||||
XtextResourceSet set = new XtextResourceSet();
|
||||
if(AllTests.isPluginContext) {
|
||||
set.setClasspathUriResolver(new BundleClasspathUriResolver());
|
||||
set.setClasspathURIContext(Activator.getDefault());
|
||||
}
|
||||
// if(AllTests.isPluginContext) {
|
||||
// set.setClasspathUriResolver(new BundleClasspathUriResolver());
|
||||
// set.setClasspathURIContext(Activator.getDefault());
|
||||
// }
|
||||
XtextResource r = (XtextResource) set.getResource(URI.createURI(uri),true);
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2008 itemis AG (http://www.itemis.eu) and others.
|
||||
* 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
|
||||
*
|
||||
*******************************************************************************
|
||||
-->
|
||||
|
||||
<project name="testsuite" default="run" basedir=".">
|
||||
<!-- The property ${eclipse-home} should be passed into this script -->
|
||||
<!-- Set a meaningful default value for when it is not. -->
|
||||
<property name="eclipse-home" value="${basedir}\..\.." />
|
||||
|
||||
<!-- sets the properties plugin-name, and library-file -->
|
||||
<property name="plugin-name" value="org.eclipse.xtext.tests" />
|
||||
<property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test/library.xml" />
|
||||
|
||||
<!-- This target holds all initialization code that needs to be done for -->
|
||||
<!-- all tests that are to be run. Initialization for individual tests -->
|
||||
<!-- should be done within the body of the suite target. -->
|
||||
<target name="init">
|
||||
<property name="classname" value="org.eclipse.xtext.resource.AllTests" />
|
||||
<tstamp />
|
||||
<delete>
|
||||
<fileset dir="${eclipse-home}" includes="org*.xml" />
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!-- Don't modify anything after this point -->
|
||||
|
||||
<!-- This target defines the tests that need to be run. -->
|
||||
<target name="suite">
|
||||
<property name="test-folder" value="${eclipse-home}/test_folder" />
|
||||
<delete dir="${test-folder}" quiet="true" />
|
||||
<ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
|
||||
<property name="data-dir" value="${test-folder}" />
|
||||
<property name="plugin-name" value="${plugin-name}" />
|
||||
<property name="classname" value="${classname}" />
|
||||
</ant>
|
||||
</target>
|
||||
|
||||
<!-- This target holds code to cleanup the testing environment after -->
|
||||
<!-- after all of the tests have been run. You can use this target to -->
|
||||
<!-- delete temporary files that have been created. -->
|
||||
<target name="cleanup">
|
||||
<mkdir dir="${results}/consolelogs" />
|
||||
<copy failonerror="false" file="${eclipse-home}/results/${classname}.txt" tofile="${results}/consolelogs/${classname}_${platform}.metadata.log.txt" />
|
||||
</target>
|
||||
|
||||
<!-- This target runs the test suite. Any actions that need to happen -->
|
||||
<!-- after all the tests have been run should go here. -->
|
||||
<target name="run" depends="init,suite,cleanup">
|
||||
<ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
|
||||
<property name="includes" value="org*.xml" />
|
||||
<property name="output-file" value="${plugin-name}.xml" />
|
||||
</ant>
|
||||
</target>
|
||||
</project>
|
Loading…
Reference in a new issue